mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
feat(backend::scheduler) fix runtime issue
This commit is contained in:
1 file changed
+3
-2
@@ -44,7 +44,6 @@ impl TaskEntity {
|
|||||||
self.status.sleeper.read().unwrap().start();
|
self.status.sleeper.read().unwrap().start();
|
||||||
if self.status.expected_running.load(Ordering::SeqCst) {
|
if self.status.expected_running.load(Ordering::SeqCst) {
|
||||||
self.func.call().await;
|
self.func.call().await;
|
||||||
|
|
||||||
if let Some(next_execution) = self.func.get_next_execution() {
|
if let Some(next_execution) = self.func.get_next_execution() {
|
||||||
*(self.status.sleeper.write().unwrap()) = next_execution.into();
|
*(self.status.sleeper.write().unwrap()) = next_execution.into();
|
||||||
} else {
|
} else {
|
||||||
@@ -104,7 +103,9 @@ impl Runner {
|
|||||||
tokio::spawn({
|
tokio::spawn({
|
||||||
let entity_clone = entity.clone();
|
let entity_clone = entity.clone();
|
||||||
async move { entity_clone.run_blocking().await }
|
async move { entity_clone.run_blocking().await }
|
||||||
});
|
})
|
||||||
|
.await
|
||||||
|
.expect("tokio runtime error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user