We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 121bf01 commit c6e3b14Copy full SHA for c6e3b14
server/src/storage/retention.rs
@@ -83,9 +83,15 @@ pub fn init_scheduler() {
83
}
84
};
85
86
+ // Execute once on startup
87
+ thread::spawn(move || {
88
+ let rt = async_runtime();
89
+ rt.block_on(func());
90
+ });
91
+
92
scheduler.every(1.day()).at("00:00").run(func);
93
- let handler = thread::spawn(|| {
94
+ let scheduler_handler = thread::spawn(|| {
95
let rt = async_runtime();
96
rt.block_on(async move {
97
loop {
@@ -95,7 +101,7 @@ pub fn init_scheduler() {
101
});
102
103
98
- *SCHEDULER_HANDLER.lock().unwrap() = Some(handler);
104
+ *SCHEDULER_HANDLER.lock().unwrap() = Some(scheduler_handler);
99
105
log::info!("Scheduler is initialized")
100
106
107
0 commit comments