Put long running into the background to end transaction

This commit is contained in:
Owen
2026-05-20 11:18:47 -07:00
parent 1a0db10b1a
commit 4b1a8e14c4

View File

@@ -600,9 +600,24 @@ async function handleMessagesForSiteClients(
exitNodeJobs.push(updateClientSiteDestinations(client, trx)); exitNodeJobs.push(updateClientSiteDestinations(client, trx));
} }
await Promise.all(exitNodeJobs); Promise.all(exitNodeJobs).catch((error) => {
await Promise.all(newtJobs); // do the servers first to make sure they are ready? logger.error(
await Promise.all(olmJobs); `rebuildClientAssociations: Error updating client site destinations for site ${site.siteId}:`,
error
);
});
Promise.all(newtJobs).catch((error) => {
logger.error(
`rebuildClientAssociations: Error updating Newt peers for site ${site.siteId}:`,
error
);
});
Promise.all(olmJobs).catch((error) => {
logger.error(
`rebuildClientAssociations: Error updating Olm peers for site ${site.siteId}:`,
error
);
});
} }
interface PeerDestination { interface PeerDestination {
@@ -1245,9 +1260,24 @@ async function handleMessagesForClientSites(
); );
} }
await Promise.all(exitNodeJobs); Promise.all(exitNodeJobs).catch((error) => {
await Promise.all(newtJobs); logger.error(
await Promise.all(olmJobs); `rebuildClientAssociations: Error updating client site destinations for client ${client.clientId}:`,
error
);
});
Promise.all(newtJobs).catch((error) => {
logger.error(
`rebuildClientAssociations: Error updating Newt peers for client ${client.clientId}:`,
error
);
});
Promise.all(olmJobs).catch((error) => {
logger.error(
`rebuildClientAssociations: Error updating Olm peers for client ${client.clientId}:`,
error
);
});
} }
async function handleMessagesForClientResources( async function handleMessagesForClientResources(