diff --git a/packages/daemon/__tests__/integration/balances.test.ts b/packages/daemon/__tests__/integration/balances.test.ts index 488ffb8c..54819074 100644 --- a/packages/daemon/__tests__/integration/balances.test.ts +++ b/packages/daemon/__tests__/integration/balances.test.ts @@ -71,7 +71,7 @@ jest.mock('../../src/config', () => { jest.mock('../../src/utils/aws', () => { return { - sendRealtimeTx: jest.fn(), + sendRealtimeTx: jest.fn().mockResolvedValue(undefined), invokeOnTxPushNotificationRequestedLambda: jest.fn(), }; }); diff --git a/packages/daemon/__tests__/integration/token_created_hybrid_with_reorg.test.ts b/packages/daemon/__tests__/integration/token_created_hybrid_with_reorg.test.ts index 8eb01c29..93439885 100644 --- a/packages/daemon/__tests__/integration/token_created_hybrid_with_reorg.test.ts +++ b/packages/daemon/__tests__/integration/token_created_hybrid_with_reorg.test.ts @@ -29,7 +29,7 @@ jest.mock('../../src/config', () => { jest.mock('../../src/utils/aws', () => { return { - sendRealtimeTx: jest.fn(), + sendRealtimeTx: jest.fn().mockResolvedValue(undefined), invokeOnTxPushNotificationRequestedLambda: jest.fn(), }; }); diff --git a/packages/daemon/__tests__/integration/token_creation.test.ts b/packages/daemon/__tests__/integration/token_creation.test.ts index 30f374eb..98219e2f 100644 --- a/packages/daemon/__tests__/integration/token_creation.test.ts +++ b/packages/daemon/__tests__/integration/token_creation.test.ts @@ -29,7 +29,7 @@ jest.mock('../../src/config', () => { jest.mock('../../src/utils/aws', () => { return { - sendRealtimeTx: jest.fn(), + sendRealtimeTx: jest.fn().mockResolvedValue(undefined), invokeOnTxPushNotificationRequestedLambda: jest.fn(), }; }); diff --git a/packages/daemon/__tests__/services/services.test.ts b/packages/daemon/__tests__/services/services.test.ts index 2d699d60..2abdb7ad 100644 --- a/packages/daemon/__tests__/services/services.test.ts +++ b/packages/daemon/__tests__/services/services.test.ts @@ -122,6 +122,7 @@ jest.mock('../../src/utils', () => ({ getFullnodeHttpUrl: jest.fn(), invokeOnTxPushNotificationRequestedLambda: jest.fn(), sendMessageSQS: jest.fn(), + sendRealtimeTx: jest.fn().mockResolvedValue(undefined), getWalletBalancesForTx: jest.fn(), generateAddresses: jest.fn(), retryWithBackoff: jest.fn((fn) => fn()), diff --git a/packages/daemon/src/services/index.ts b/packages/daemon/src/services/index.ts index 7b154023..836280b3 100644 --- a/packages/daemon/src/services/index.ts +++ b/packages/daemon/src/services/index.ts @@ -528,16 +528,15 @@ export const handleVertexAccepted = async (context: Context, _event: Event) => { signal_bits: 0, // TODO: we should actually receive this and store in the database }; - try { - if (seenWallets.length > 0) { - await sendRealtimeTx( - Array.from(seenWallets), - txData, - ); - } - } catch (e) { - logger.error('Failed to send transaction to SQS queue'); - logger.error(e); + // Fire-and-forget: SQS publish is a best-effort real-time + // notification and must not block the handler. Matches the pattern + // used for invokeOnTxPushNotificationRequestedLambda below. + if (seenWallets.length > 0) { + sendRealtimeTx(Array.from(seenWallets), txData) + .catch((err: Error) => { + logger.error('Failed to send transaction to SQS queue'); + logger.error(err); + }); } try {