From 6861687b1fde2150a3050711fc879154c28a1ff3 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 21 Nov 2026 11:22:47 +0100 Subject: [PATCH] fix(server): queue the backfill's updates instead of awaiting them in a loop Server lint was red on dev: lint:warnings counted 557 no-await-in-loop warnings in src against a baseline of 556, from the UPDATE the new admin-made account backfill awaited per account. The updates are now queued with addSql, the way the Ireland counties migration queues its row writes, with the id checked to be an integer. The migration does the same as before; it has not shipped in a release. --- ...80_an_address_changed_after_an_admin_made_the_account.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/db/migrations/Migration20200101046480_an_address_changed_after_an_admin_made_the_account.ts b/server/src/db/migrations/Migration20200101046480_an_address_changed_after_an_admin_made_the_account.ts index 176773fed..6d3305483 100644 --- a/server/src/db/migrations/Migration20200101046480_an_address_changed_after_an_admin_made_the_account.ts +++ b/server/src/db/migrations/Migration20200101046480_an_address_changed_after_an_admin_made_the_account.ts @@ -84,11 +84,15 @@ export class Migration20200101046480_an_address_changed_after_an_admin_made_the_ const users = (await this.execute( `SELECT id, email FROM users WHERE COALESCE(is_guest, 0) = 0 AND email_self_asserted = 0`, )) as UserEmailRow[]; + // Queued, run after up() returns; the id comes from the database and is + // checked to be an integer, nothing a user typed. for (const user of users) { const id = String(user.id); if (!createdByAdmin.has(id) || editedByAdmin.has(id)) continue; if (baselines.get(id)?.includes(user.email.trim().toLowerCase())) continue; - await this.execute('UPDATE users SET email_self_asserted = 1 WHERE id = ?', [user.id]); + const rowId = Number(user.id); + if (!Number.isInteger(rowId)) continue; + this.addSql(`UPDATE users SET email_self_asserted = 1 WHERE id = ${rowId}`); } } }