Skip to content

Commit

Permalink
Service framework background tasks and watchdogs (#39)
Browse files Browse the repository at this point in the history
* Service framework background task

 - Implement an optional background task for services that starts automatically on service start.
 - Implement a watchdog that updates the service's status when its task fails at runtime

* WIP: Partially implemented

 - Background task startup + watchdog implemented for service startup
 - Implementation for service shutdown missing
 - Handling of watchdog triggers of essential tasks missing

* Refactor of service framework

Split service framework into multiple submodules

* Implement Watchdog module

* Optimize Watchdog module

Make usage of Watchdog more flexible

* Refactor start_service

Refactor the giant block of cod e into smaller helper methods where possible

* Edit StartupError string representations

* Finish refactor of start_service method

* Refactor stop_service

 - Apply same refactoring to stop_service
 - Increase name placeholder space to 30 in logger
  • Loading branch information
Kitt3120 committed Jan 26, 2024
1 parent 1fe0dbf commit 1ebdec9
Show file tree
Hide file tree
Showing 8 changed files with 757 additions and 538 deletions.
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
max_width = 110
2 changes: 1 addition & 1 deletion src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn setup() -> Result<(), SetLoggerError> {
fern::Dispatch::new()
.format(move |out, message, record| {
out.finish(format_args!(
"[{} {: <25} {: <5}] {}",
"[{} {: <30} {: <5}] {}",
humantime::format_rfc3339_seconds(SystemTime::now()),
record.target(),
colors.color(record.level()),
Expand Down
Loading

0 comments on commit 1ebdec9

Please sign in to comment.