File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import { configDotenv } from "dotenv";
22
22
import type { Job , JobState , Queue } from "bullmq" ;
23
23
import { logger } from "../../lib/logger" ;
24
24
import { supabase_rr_service , supabase_service } from "../../services/supabase" ;
25
- import { getConcurrencyLimitedJobs } from "../../lib/concurrency-limit" ;
25
+ import { getConcurrencyLimitedJobs , getCrawlConcurrencyLimitActiveJobs } from "../../lib/concurrency-limit" ;
26
26
import { getJobFromGCS } from "../../lib/gcs-jobs" ;
27
27
configDotenv ( ) ;
28
28
@@ -163,6 +163,7 @@ export async function crawlStatusController(
163
163
) ;
164
164
165
165
const throttledJobsSet = new Set ( await getConcurrencyLimitedJobs ( req . auth . team_id ) ) ;
166
+ const activeJobsSet = new Set ( await getCrawlConcurrencyLimitActiveJobs ( req . params . jobId ) ) ;
166
167
167
168
const validJobStatuses : [ string , JobState | "unknown" ] [ ] = [ ] ;
168
169
const validJobIDs : string [ ] = [ ] ;
@@ -171,6 +172,9 @@ export async function crawlStatusController(
171
172
if ( throttledJobsSet . has ( id ) ) {
172
173
validJobStatuses . push ( [ id , "prioritized" ] ) ;
173
174
validJobIDs . push ( id ) ;
175
+ } else if ( status === "unknown" && activeJobsSet . has ( id ) ) {
176
+ validJobStatuses . push ( [ id , "active" ] ) ;
177
+ validJobIDs . push ( id ) ;
174
178
} else if (
175
179
status !== "failed" &&
176
180
status !== "unknown"
Original file line number Diff line number Diff line change @@ -216,8 +216,7 @@ async function getNextConcurrentJob(teamId: string): Promise<{
216
216
}
217
217
218
218
for ( const ignoredJob of ignoredJobs ) {
219
- const timeout = ignoredJob . timeout - Date . now ( ) ;
220
- await pushConcurrencyLimitedJob ( teamId , ignoredJob . job , timeout ) ;
219
+ await pushConcurrencyLimitedJob ( teamId , ignoredJob . job , ignoredJob . timeout ) ;
221
220
}
222
221
223
222
return finalJob ;
You can’t perform that action at this time.
0 commit comments