diff --git a/src/handlers/activity.rs b/src/handlers/activity.rs index 447b416..b98b93d 100644 --- a/src/handlers/activity.rs +++ b/src/handlers/activity.rs @@ -152,9 +152,9 @@ impl ActivityTracker { pub fn add_new_activity_to_queue(&self, new_activity: Activity) -> Result<(), AppError> { let mut locked_queue = self.lock_activity_queue()?; - locked_queue.push_back(new_activity); + locked_queue.push_front(new_activity); if locked_queue.len() > self.queue_size.into() { - locked_queue.pop_front(); + locked_queue.pop_back(); } Ok(()) } @@ -296,7 +296,7 @@ impl ActivityTracker { // unoptimized lock usage doesn't matter here. // This is only going to run at the start of the program once if self.spam_prevention(&activity)? { - self.lock_activity_queue()?.push_back(activity); + self.lock_activity_queue()?.push_front(activity); } if self.lock_activity_queue()?.len() >= self.queue_size.into() { break 'outer;