Skip to content

Commit 869fd23

Browse files
committed
fix(webapp): bound realtime publisher retries instead of disabling its offline queue
1 parent 03bc55c commit 869fd23

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

apps/webapp/app/redis.server.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ export type RedisWithClusterOptions = {
1111
clusterMode?: boolean;
1212
clusterOptions?: Omit<ClusterOptions, "redisOptions">;
1313
keyPrefix?: string;
14-
/** Reject commands immediately when the connection isn't ready instead of buffering them in memory (default: ioredis's `true`). */
15-
enableOfflineQueue?: boolean;
16-
/** Cap retries for an in-flight command before it rejects; `null` means unlimited (default: ioredis's default of 20). */
14+
/** Cap retries for a command before it rejects; `null` means unlimited (default: ioredis's default of 20). */
1715
maxRetriesPerRequest?: number | null;
1816
};
1917

@@ -41,9 +39,6 @@ export function createRedisClient(
4139

4240
redis = new Redis.Cluster(nodes, {
4341
...options.clusterOptions,
44-
...(options.enableOfflineQueue !== undefined
45-
? { enableOfflineQueue: options.enableOfflineQueue }
46-
: {}),
4742
redisOptions: {
4843
connectionName,
4944
keyPrefix: options.keyPrefix,
@@ -82,9 +77,6 @@ export function createRedisClient(
8277
enableAutoPipelining: true,
8378
keyPrefix: options.keyPrefix,
8479
reconnectOnError: defaultReconnectOnError,
85-
...(options.enableOfflineQueue !== undefined
86-
? { enableOfflineQueue: options.enableOfflineQueue }
87-
: {}),
8880
...(options.maxRetriesPerRequest !== undefined
8981
? { maxRetriesPerRequest: options.maxRetriesPerRequest }
9082
: {}),

apps/webapp/app/services/realtime/runChangeNotifier.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ export class RunChangeNotifier {
226226
#ensurePublisher(): RedisClient {
227227
if (!this.#publisher) {
228228
// Publishes are fire-and-forget with a consumer-side backstop, so a dropped publish is
229-
// latency-only. Fail fast rather than buffer commands in memory during a pub/sub outage.
229+
// latency-only. Cap retries (vs ioredis's default 20) so a pub/sub outage rejects publishes
230+
// after ~1 reconnect cycle instead of buffering them in memory across the fleet.
230231
this.#publisher = createRedisClient(`${this.#connectionName}:pub`, {
231232
...this.options.redis,
232-
enableOfflineQueue: false,
233233
maxRetriesPerRequest: 1,
234234
});
235235
}

0 commit comments

Comments
 (0)