Skip to content

Commit 354f674

Browse files
committed
fix(executor): publish cancellation event on Redis write failure
1 parent b3a676e commit 354f674

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

apps/sim/lib/execution/cancellation.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ describe('markExecutionCancelled', () => {
5959
})
6060
})
6161

62+
it('publishes even when the Redis write fails so local subscribers wake up', async () => {
63+
mockRedisSet.mockRejectedValue(new Error('set failed'))
64+
mockGetRedisClient.mockReturnValue({ set: mockRedisSet })
65+
66+
await markExecutionCancelled('execution-write-failed')
67+
68+
expect(mockPublish).toHaveBeenCalledWith({ executionId: 'execution-write-failed' })
69+
})
70+
6271
it('publishes a cancellation event after a successful Redis write', async () => {
6372
mockRedisSet.mockResolvedValue('OK')
6473
mockGetRedisClient.mockReturnValue({ set: mockRedisSet })

apps/sim/lib/execution/cancellation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export async function markExecutionCancelled(
5252
return { durablyRecorded: true, reason: 'recorded' }
5353
} catch (error) {
5454
logger.error('Failed to mark execution as cancelled', { executionId, error })
55+
getCancellationChannel().publish({ executionId })
5556
return { durablyRecorded: false, reason: 'redis_write_failed' }
5657
}
5758
}

0 commit comments

Comments
 (0)