@@ -23,8 +23,6 @@ type JobPayload = {
2323 repoName : string ;
2424} ;
2525
26- const JOB_TIMEOUT_MS = 1000 * 60 * 60 * 6 ; // 6 hour indexing timeout
27-
2826/**
2927 * Manages the lifecycle of repository data on disk, including git working copies
3028 * and search index shards. Handles both indexing operations (cloning/fetching repos
@@ -49,7 +47,7 @@ export class RepoIndexManager {
4947 this . queue = new Queue < JobPayload > ( {
5048 redis,
5149 namespace : 'repo-index-queue' ,
52- jobTimeoutMs : JOB_TIMEOUT_MS ,
50+ jobTimeoutMs : this . settings . repoIndexTimeoutMs ,
5351 maxAttempts : 3 ,
5452 logger : env . DEBUG_ENABLE_GROUPMQ_LOGGING === 'true' ,
5553 } ) ;
@@ -82,6 +80,8 @@ export class RepoIndexManager {
8280
8381 private async scheduleIndexJobs ( ) {
8482 const thresholdDate = new Date ( Date . now ( ) - this . settings . reindexIntervalMs ) ;
83+ const timeoutDate = new Date ( Date . now ( ) - this . settings . repoIndexTimeoutMs ) ;
84+
8585 const reposToIndex = await this . db . repo . findMany ( {
8686 where : {
8787 AND : [
@@ -115,7 +115,7 @@ export class RepoIndexManager {
115115 } ,
116116 {
117117 createdAt : {
118- gt : thresholdDate ,
118+ gt : timeoutDate ,
119119 }
120120 }
121121 ]
@@ -124,7 +124,7 @@ export class RepoIndexManager {
124124 {
125125 AND : [
126126 { status : RepoIndexingJobStatus . FAILED } ,
127- { completedAt : { gt : thresholdDate } } ,
127+ { completedAt : { gt : timeoutDate } } ,
128128 ]
129129 }
130130 ]
0 commit comments