fix(retry): address PR #12 code review feedback
- Add 'stepped' backoff strategy that uses RETRY_BACKOFF_DELAYS directly - Update rsocket config to use 'stepped' instead of 'exponential' - Clarify maxWebSocketListeners calculation (8 core + 10 dynamic + 2 buffer) - Document maxSocketClientListeners calculation (20 core + 20 dynamic + 10 buffer) - Change 'exponential backoff' to 'custom progressive backoff' in docs - Add comprehensive tests for getRetryDelayWithJitter and getAllRetryDelaysWithJitter - Fix existing test type errors (onRetry mock, always/never predicates)
This commit is contained in:
@@ -82,8 +82,13 @@ export const DEFAULT_CONNECTION_CONFIG: SocketConfig = {
|
||||
// Circuit breaker configuration
|
||||
enableCircuitBreaker: true,
|
||||
// Listener limits (memory leak prevention)
|
||||
// 8 base WS events + 10 dynamic listeners + 2 buffer slots
|
||||
// WebSocket: 8 core events (open, close, error, message, ping, pong, upgrade, unexpected-response)
|
||||
// + 10 dynamic listeners (reconnect handlers, custom events)
|
||||
// + 2 buffer slots for temporary listeners = 20 total
|
||||
maxWebSocketListeners: 20,
|
||||
// SocketClient: 20 core events (connection, messaging, presence, groups, calls, etc.)
|
||||
// + 20 dynamic listeners (user handlers, plugins)
|
||||
// + 10 buffer slots for high-load scenarios = 50 total
|
||||
maxSocketClientListeners: 50
|
||||
}
|
||||
|
||||
@@ -165,8 +170,9 @@ export const DEFAULT_CACHE_MAX_KEYS = {
|
||||
}
|
||||
|
||||
/**
|
||||
* Retry configuration with exponential backoff
|
||||
* Delays in milliseconds: 1s, 2s, 5s, 10s, 20s
|
||||
* Retry configuration with custom progressive backoff
|
||||
* Fixed delay steps in milliseconds: 1s → 2s → 5s → 10s → 20s
|
||||
* Use with 'stepped' backoff strategy in retry-utils.ts
|
||||
*/
|
||||
export const RETRY_BACKOFF_DELAYS = [1000, 2000, 5000, 10000, 20000]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user