chore: fix checklist potential panic (#5561)

* chore: fix checklist

* chore: fix checklist
This commit is contained in:
Nathan.fooo
2024-06-18 10:16:39 +08:00
committed by GitHub
parent e607694729
commit 3e75f1f24a
4 changed files with 31 additions and 17 deletions

View File

@ -34,7 +34,8 @@ impl TaskQueue {
match self.index_tasks.entry(task.handler_id.clone()) {
Entry::Occupied(entry) => {
let mut list = entry.get().borrow_mut();
assert!(list
debug_assert!(list
.peek()
.map(|old_id| pending_task.id >= old_id.id)
.unwrap_or(true));

View File

@ -45,7 +45,7 @@ impl TaskStore {
}
pub(crate) fn next_task_id(&self) -> TaskId {
let _ = self.task_id_counter.fetch_add(1, SeqCst);
self.task_id_counter.load(SeqCst)
let old = self.task_id_counter.fetch_add(1, SeqCst);
old + 1
}
}