Skip to content

Commit 1448133

Browse files
fix(queue-status): read most-recent-success from the Redis it is written to (firecrawl#3819)
The scrape worker writes most-recent-success:{team_id} via redisEvictConnection (REDIS_EVICT_URL ?? REDIS_RATE_LIMIT_URL), but the v1/v2 queue-status controllers read it via getRedisConnection() (REDIS_URL). In production these are separate Redis instances, so the key is never visible to the reader and mostRecentSuccess is always returned as null even while jobs are succeeding. Read the key from redisEvictConnection so the value is fetched from the same instance it is written to. Co-authored-by: firecrawl-spring[bot] <254786068+firecrawl-spring[bot]@users.noreply.github.com> Co-authored-by: micahstairs <micah@sideguide.dev>
1 parent df88fb6 commit 1448133

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

apps/api/src/controllers/v1/queue-status.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { RateLimiterMode } from "../../types";
22
import { getACUCTeam } from "../auth";
33
import { AuthCreditUsageChunkFromTeam, RequestWithAuth } from "./types";
44
import { Response } from "express";
5-
import { getRedisConnection } from "../../services/queue-service";
5+
import { redisEvictConnection } from "../../services/redis";
66
import { isFdbTeam } from "../../services/worker/nuq-router";
77
import {
88
nuqFdbHealthCheck,
@@ -82,7 +82,10 @@ export async function queueStatusController(
8282
}
8383
}
8484

85-
const mostRecentSuccess = await getRedisConnection().get(
85+
// most-recent-success is written by the scrape worker via redisEvictConnection
86+
// (REDIS_EVICT_URL), which is a different instance from getRedisConnection()
87+
// (REDIS_URL). Read it from the same connection it is written to.
88+
const mostRecentSuccess = await redisEvictConnection.get(
8689
"most-recent-success:" + req.auth.team_id,
8790
);
8891

apps/api/src/controllers/v2/queue-status.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getACUCTeam } from "../auth";
33
import { RequestWithAuth } from "./types";
44
import { AuthCreditUsageChunkFromTeam } from "../v1/types";
55
import { Response } from "express";
6-
import { getRedisConnection } from "../../services/queue-service";
6+
import { redisEvictConnection } from "../../services/redis";
77
import { isFdbTeam } from "../../services/worker/nuq-router";
88
import {
99
nuqFdbHealthCheck,
@@ -83,7 +83,10 @@ export async function queueStatusController(
8383
}
8484
}
8585

86-
const mostRecentSuccess = await getRedisConnection().get(
86+
// most-recent-success is written by the scrape worker via redisEvictConnection
87+
// (REDIS_EVICT_URL), which is a different instance from getRedisConnection()
88+
// (REDIS_URL). Read it from the same connection it is written to.
89+
const mostRecentSuccess = await redisEvictConnection.get(
8790
"most-recent-success:" + req.auth.team_id,
8891
);
8992

0 commit comments

Comments
 (0)