Skip to content

Commit c6e3b14

Browse files
authored
fix: retention cleanup on server startup (#662)
fixes #660
1 parent 121bf01 commit c6e3b14

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Diff for: server/src/storage/retention.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,15 @@ pub fn init_scheduler() {
8383
}
8484
};
8585

86+
// Execute once on startup
87+
thread::spawn(move || {
88+
let rt = async_runtime();
89+
rt.block_on(func());
90+
});
91+
8692
scheduler.every(1.day()).at("00:00").run(func);
8793

88-
let handler = thread::spawn(|| {
94+
let scheduler_handler = thread::spawn(|| {
8995
let rt = async_runtime();
9096
rt.block_on(async move {
9197
loop {
@@ -95,7 +101,7 @@ pub fn init_scheduler() {
95101
});
96102
});
97103

98-
*SCHEDULER_HANDLER.lock().unwrap() = Some(handler);
104+
*SCHEDULER_HANDLER.lock().unwrap() = Some(scheduler_handler);
99105
log::info!("Scheduler is initialized")
100106
}
101107

0 commit comments

Comments
 (0)