Page MenuHomePhabricator

D9201.diff
No OneTemporary

D9201.diff

diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -148,15 +148,7 @@
}
}
- const cleanUpPromises = [];
- if (dbIDs.length > 0) {
- const query = SQL`DELETE FROM ids WHERE id IN (${dbIDs})`;
- cleanUpPromises.push(dbQuery(query));
- }
- const [deliveryResults] = await Promise.all([
- Promise.all(deliveryPromises),
- Promise.all(cleanUpPromises),
- ]);
+ const deliveryResults = await Promise.all(deliveryPromises);
const flattenedDeliveryResults = [];
for (const innerDeliveryResults of deliveryResults) {
@@ -168,7 +160,18 @@
}
}
- await saveNotifResults(flattenedDeliveryResults, notifications, true);
+ const cleanUpPromise = (async () => {
+ if (dbIDs.length === 0) {
+ return;
+ }
+ const query = SQL`DELETE FROM ids WHERE id IN (${dbIDs})`;
+ await dbQuery(query);
+ })();
+
+ await Promise.all([
+ cleanUpPromise,
+ saveNotifResults(flattenedDeliveryResults, notifications, true),
+ ]);
}
async function sendPushNotif(input: {

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 2, 9:18 PM (18 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2608962
Default Alt Text
D9201.diff (1 KB)

Event Timeline