Skip to content

Commit 7262021

Browse files
committed
chore: hashset for tiles
1 parent ea85f4d commit 7262021

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/handlers/http/modal/utils/logstream_utils.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
*
1717
*/
1818

19+
use std::collections::HashSet;
20+
1921
use actix_web::http::header::HeaderMap;
2022
use bytes::Bytes;
2123
use ulid::Ulid;
@@ -97,7 +99,7 @@ pub struct LogstreamAffectedResources {
9799
#[derive(Debug, Default, serde::Serialize)]
98100
pub struct LogstreamAffectedDashboard {
99101
pub dashboard_id: Ulid,
100-
pub affected_tile_ids: Vec<Ulid>,
102+
pub affected_tile_ids: HashSet<Ulid>,
101103
}
102104

103105
#[derive(thiserror::Error, Debug)]
@@ -190,7 +192,7 @@ impl LogstreamAffectedResources {
190192
continue;
191193
};
192194

193-
let mut affected_tile_ids = Vec::<Ulid>::new();
195+
let mut affected_tile_ids = HashSet::<Ulid>::new();
194196
for tile in tiles {
195197
let Some(tile_fields) = tile.other_fields.as_ref() else {
196198
continue;
@@ -209,8 +211,8 @@ impl LogstreamAffectedResources {
209211
}
210212
});
211213

212-
if dbs_have_stream && !affected_tile_ids.contains(&tile.tile_id) {
213-
affected_tile_ids.push(tile.tile_id);
214+
if dbs_have_stream {
215+
affected_tile_ids.insert(tile.tile_id);
214216
}
215217
}
216218
}

0 commit comments

Comments
 (0)