File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -364,11 +364,16 @@ export class PrebuildManager {
364
364
365
365
private async shouldSkipInactiveRepository ( ctx : TraceContext , cloneURL : string ) : Promise < boolean > {
366
366
const span = TraceContext . startSpan ( "shouldSkipInactiveRepository" , ctx ) ;
367
+ const { inactivityPeriodForRepos } = this . config ;
368
+ if ( ! inactivityPeriodForRepos ) {
369
+ // skipping is disabled if `inactivityPeriodForRepos` is not set
370
+ return false ;
371
+ }
367
372
try {
368
373
return (
369
374
( await this . workspaceDB
370
375
. trace ( { span } )
371
- . getWorkspaceCountByCloneURL ( cloneURL , 7 /* last week */ , "regular" ) ) === 0
376
+ . getWorkspaceCountByCloneURL ( cloneURL , inactivityPeriodForRepos /* in days */ , "regular" ) ) === 0
372
377
) ;
373
378
} catch ( error ) {
374
379
log . error ( "cannot compute activity for repository" , { cloneURL } , error ) ;
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ export type Config = Omit<
27
27
chargebeeProviderOptions ?: ChargebeeProviderOptions ;
28
28
builtinAuthProvidersConfigured : boolean ;
29
29
blockedRepositories : { urlRegExp : RegExp ; blockUser : boolean } [ ] ;
30
+ inactivityPeriodForRepos ?: number ;
30
31
} ;
31
32
32
33
export interface WorkspaceDefaults {
@@ -162,6 +163,12 @@ export interface ConfigSerialized {
162
163
* `blockUser` attribute to control handling of the user's account.
163
164
*/
164
165
blockedRepositories ?: { urlRegExp : string ; blockUser : boolean } [ ] ;
166
+
167
+ /**
168
+ * If a numeric value interpreted as days is set, repositories not beeing opened with Gitpod are
169
+ * considered inactive.
170
+ */
171
+ inactivityPeriodForRepos ?: number ;
165
172
}
166
173
167
174
export namespace ConfigFile {
@@ -220,6 +227,12 @@ export namespace ConfigFile {
220
227
} ) ;
221
228
}
222
229
}
230
+ let inactivityPeriodForRepos : number | undefined ;
231
+ if ( typeof config . inactivityPeriodForRepos === "number" ) {
232
+ if ( config . inactivityPeriodForRepos >= 1 ) {
233
+ inactivityPeriodForRepos = config . inactivityPeriodForRepos ;
234
+ }
235
+ }
223
236
return {
224
237
...config ,
225
238
hostUrl,
@@ -234,6 +247,7 @@ export namespace ConfigFile {
234
247
: Date . now ( ) ,
235
248
} ,
236
249
blockedRepositories,
250
+ inactivityPeriodForRepos,
237
251
} ;
238
252
}
239
253
}
You can’t perform that action at this time.
0 commit comments