Skip to content

Commit bcd7b26

Browse files
committed
feat: add socket timeout
1 parent f96ba2d commit bcd7b26

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/core/shared/clients/kv.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ function createRedisClient() {
5353
// behind the auto-reconnect. Preserves the {status: 'error'} envelope on
5454
// pingKv() and keeps /api/health snappy during Redis outages.
5555
disableOfflineQueue: true,
56+
socket: {
57+
socketTimeout: 10_000,
58+
},
5659
})
5760

5861
client.on('error', (error) => {

tests/unit/kv.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ describe('optional KV client', () => {
103103
expect(createClient).toHaveBeenCalledWith({
104104
url: 'redis://localhost:6379',
105105
disableOfflineQueue: true,
106+
socket: {
107+
socketTimeout: 10_000,
108+
},
106109
})
107110
expect(redisClient.on).toHaveBeenCalledWith('error', expect.any(Function))
108111
expect(redisClient.on).toHaveBeenCalledWith('end', expect.any(Function))

0 commit comments

Comments
 (0)