Skip to content

Commit

Permalink
added log for number of removed messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Jan 6, 2025
1 parent 7b1436d commit 513ded2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions common/gateway-storage/src/inboxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use crate::models::StoredMessage;
use time::OffsetDateTime;
use tracing::debug;

#[derive(Clone)]
pub struct InboxManager {
Expand Down Expand Up @@ -127,9 +128,11 @@ impl InboxManager {
}

pub async fn remove_stale(&self, cutoff: OffsetDateTime) -> Result<(), sqlx::Error> {
sqlx::query!("DELETE FROM message_store WHERE timestamp < ?", cutoff)
let affected = sqlx::query!("DELETE FROM message_store WHERE timestamp < ?", cutoff)
.execute(&self.connection_pool)
.await?;
.await?
.rows_affected();
debug!("Removed {affected} stale messages");
Ok(())
}
}

0 comments on commit 513ded2

Please sign in to comment.