File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
components/gitpod-protocol/src Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -358,6 +358,8 @@ export interface ClientHeaderFields {
358358 clientRegion ?: string ;
359359}
360360
361+ const WORKSPACE_MAXIMUM_TIMEOUT_HOURS = 24 ;
362+
361363export type WorkspaceTimeoutDuration = string ;
362364export namespace WorkspaceTimeoutDuration {
363365 export function validate ( duration : string ) : WorkspaceTimeoutDuration {
@@ -369,6 +371,12 @@ export namespace WorkspaceTimeoutDuration {
369371 if ( isNaN ( value ) || value <= 0 ) {
370372 throw new Error ( `Invalid timeout value: ${ duration } ` ) ;
371373 }
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+ }
372380 return duration ;
373381 }
374382}
You can’t perform that action at this time.
0 commit comments