Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/daemon/__tests__/integration/balances.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
});
Expand Down
1 change: 1 addition & 0 deletions packages/daemon/__tests__/services/services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
19 changes: 9 additions & 10 deletions packages/daemon/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading