Skip to content

Commit 735c0df

Browse files
committed
fixup! For performance, switch to a row count estimate for users and devices
1 parent 7a80ed8 commit 735c0df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/syn2mas/src/migration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub async fn migrate(
165165
.expect("More than usize::MAX devices — unable to handle this many!")
166166
// Oversize the capacity, because the count is only an estimate and
167167
// we would like to avoid a reallocation
168-
* 3 / 2,
168+
* 9 / 8,
169169
);
170170

171171
span.pb_set_message("migrating access tokens");
@@ -255,7 +255,7 @@ async fn migrate_users(
255255
let mut users_stream = pin!(synapse.read_users());
256256
// Oversize the capacity, because the count is only an estimate and
257257
// we would like to avoid a reallocation
258-
let mut user_localparts_to_uuid = HashMap::with_capacity(user_count_hint * 3 / 2);
258+
let mut user_localparts_to_uuid = HashMap::with_capacity(user_count_hint * 9 / 8);
259259
let mut synapse_admins = HashSet::new();
260260

261261
while let Some(user_res) = users_stream.next().await {

0 commit comments

Comments
 (0)