Skip to content

Commit

Permalink
refactor: get max task id
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukesor committed Feb 22, 2025
1 parent 195de37 commit c95b1ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pueue/src/daemon/internal_state/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ impl InternalState {

/// Add a new task
pub fn add_task(&mut self, mut task: Task) -> usize {
let next_id = match self.tasks().keys().max() {
let next_id = match self.tasks().last_key_value() {
None => 0,
Some(id) => id + 1,
Some((id, _)) => id + 1,
};
task.id = next_id;
self.tasks_mut().insert(next_id, task);
Expand Down

0 comments on commit c95b1ee

Please sign in to comment.