File tree 1 file changed +8
-0
lines changed
components/gitpod-protocol/src
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,8 @@ export interface ClientHeaderFields {
358
358
clientRegion ?: string ;
359
359
}
360
360
361
+ const WORKSPACE_MAXIMUM_TIMEOUT_HOURS = 24 ;
362
+
361
363
export type WorkspaceTimeoutDuration = string ;
362
364
export namespace WorkspaceTimeoutDuration {
363
365
export function validate ( duration : string ) : WorkspaceTimeoutDuration {
@@ -369,6 +371,12 @@ export namespace WorkspaceTimeoutDuration {
369
371
if ( isNaN ( value ) || value <= 0 ) {
370
372
throw new Error ( `Invalid timeout value: ${ duration } ` ) ;
371
373
}
374
+ if (
375
+ ( unit === "h" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS ) ||
376
+ ( unit === "m" && value > WORKSPACE_MAXIMUM_TIMEOUT_HOURS * 60 )
377
+ ) {
378
+ throw new Error ( `Timeouts cannot extend to more than a day` ) ;
379
+ }
372
380
return duration ;
373
381
}
374
382
}
You can’t perform that action at this time.
0 commit comments