Skip to content

Commit

Permalink
fix worker crash at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
fluxxu committed Sep 26, 2022
1 parent 0d3f3f2 commit 3223281
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 1 addition & 7 deletions binaries/flo-worker/src/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,10 @@ pub fn init(debug: bool) {
.with_writer(non_blocking)
.with_ansi(false)
.init();

tokio::spawn(async {
start_log_vacuum("flo-logs").await.map_err(|err| {
tracing::error!("log_vacuum: {}", err);
})
});
}

#[cfg(not(debug_assertions))]
async fn start_log_vacuum(path: &str) -> anyhow::Result<()> {
pub async fn start_log_vacuum(path: &str) -> anyhow::Result<()> {
use std::time::{Duration, SystemTime};
use tokio::fs;

Expand Down
7 changes: 7 additions & 0 deletions binaries/flo-worker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ fn main() {

match res {
Ok((port, rt)) => {
#[cfg(not(debug_assertions))]
rt.spawn(async {
log::start_log_vacuum("flo-logs").await.map_err(|err| {
tracing::error!("log_vacuum: {}", err);
})
});

let msg = serde_json::to_string(&serde_json::json!({
"version": flo_client::FLO_VERSION.to_string(),
"port": port
Expand Down

0 comments on commit 3223281

Please sign in to comment.