Handle transactions that timeout without starting (#94)

* Handle transactions that timeout without starting

* Use shorter syntax
This commit is contained in:
Fahrzin Hemmati 2024-02-14 13:43:04 -08:00 committed by GitHub
parent 725f2bf6e3
commit 9babf1cd6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -265,7 +265,7 @@ export const addWebsocketServer = (env: RouteInitEnvironment) => {
finish: undefined,
timeout: setTimeout(() => {
delete client.transactions[tx.id];
tx.finish(); // Finish without value cancels the transaction
tx.finish?.(); // Finish without value cancels the transaction
env.log.error(LOG_ACTION, 'timeout', LOG_DETAILS);
serverManager.send(event.socket, 'tx_error', { id: tx.id, reason: 'timeout' });
}, TRANSACTION_TIMEOUT_MS),