From 9babf1cd6fcdcef4fc05ecfedd7c82a5183ce80a Mon Sep 17 00:00:00 2001 From: Fahrzin Hemmati Date: Wed, 14 Feb 2024 13:43:04 -0800 Subject: [PATCH] Handle transactions that timeout without starting (#94) * Handle transactions that timeout without starting * Use shorter syntax --- src/websocket/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/websocket/index.ts b/src/websocket/index.ts index 391a08d..ad2f44f 100644 --- a/src/websocket/index.ts +++ b/src/websocket/index.ts @@ -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),