Skip to content

Commit 4f33dad

Browse files
committed
fix: /:id/events reset aggr on save
1 parent 29e8930 commit 4f33dad

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sentry/src/event_aggregator.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use std::sync::{Arc};
1919

2020
#[derive(Default, Clone)]
2121
pub struct EventAggregator {
22-
// recorder: HashMap<ChannelId, FnMut(&Session, &str) -> BoxFuture>,
2322
aggregate: Arc<RwLock<HashMap<String, EventAggregate>>>
2423
}
2524

@@ -32,12 +31,14 @@ pub fn new_aggr(channel_id: &ChannelId) -> EventAggregate {
3231
}
3332

3433
async fn store(db: &DbPool, channel_id: &ChannelId, aggr: Arc<RwLock<HashMap<String, EventAggregate>>>) {
35-
let recorder = aggr.write().await;
34+
let mut recorder = aggr.write().await;
3635
let ev_aggr: Option<&EventAggregate> = recorder.get(&channel_id.to_string());
3736
if let Some(data) = ev_aggr {
3837
if let Err(e) = insert_event_aggregate(&db, &channel_id, data).await {
3938
eprintln!("{}", e);
4039
};
40+
// reset aggr
41+
recorder.insert(channel_id.to_string(), new_aggr(&channel_id));
4142
}
4243
}
4344

0 commit comments

Comments
 (0)