Skip to content

Commit

Permalink
event-broker: Disable inotify when no subscribers are available
Browse files Browse the repository at this point in the history
When no subscribers are available, event-broker doesn't need to
monitor the log file.  This stops the monitoring when the last
subscriber leaves and restart it upon a new subscriber being
connected.

This also adds handling of Ctrl-C to stop the deamon if it is not
activated through systemd.

Signed-off-by: Daiki Ueno <[email protected]>
  • Loading branch information
ueno committed Apr 1, 2024
1 parent 636c61f commit 8fc2832
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 100 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ thiserror = "1.0"
time = "0.3"
tokio = "1.23"
tokio-serde = { version = "0.8", features = ["cbor"] }
tokio-stream = "0.1"
tokio-stream = { version = "0.1", features = ["sync"] }
tokio-util = { version = "0.7", features = ["codec"] }
toml = "0.7"
tracing = "0.1"
Expand Down
2 changes: 1 addition & 1 deletion event-broker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ futures.workspace = true
inotify.workspace = true
libsystemd = { version = "0.7", optional = true }
serde_cbor.workspace = true
tokio = { workspace = true, features = ["macros", "rt-multi-thread"] }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] }
tokio-serde.workspace = true
tokio-stream.workspace = true
tokio-util.workspace = true
Expand Down
Loading

0 comments on commit 8fc2832

Please sign in to comment.