@@ -42,7 +42,6 @@ import { withInit } from "../../common/onInit";
4242interface SeparatedOpts {
4343 schedule : string | Expression < string > ;
4444 timeZone ?: timezone | Expression < string > | ResetValue ;
45- attemptDeadlineSeconds ?: number | Expression < number > | ResetValue ;
4645 retryConfig ?: {
4746 retryCount ?: number | Expression < number > | ResetValue ;
4847 maxRetrySeconds ?: number | Expression < number > | ResetValue ;
@@ -64,7 +63,6 @@ export function getOpts(args: string | ScheduleOptions): SeparatedOpts {
6463 return {
6564 schedule : args . schedule ,
6665 timeZone : args . timeZone ,
67- attemptDeadlineSeconds : args . attemptDeadlineSeconds ,
6866 retryConfig : {
6967 retryCount : args . retryCount ,
7068 maxRetrySeconds : args . maxRetrySeconds ,
@@ -113,12 +111,6 @@ export interface ScheduleOptions extends options.GlobalOptions {
113111 /** The timezone that the schedule executes in. */
114112 timeZone ?: timezone | Expression < string > | ResetValue ;
115113
116- /**
117- * The deadline for job attempts in seconds. If the request handler does not respond by this deadline,
118- * the request is cancelled and the attempt is marked as a `DEADLINE_EXCEEDED` failure.
119- * The value must be between 15 and 1800. Defaults to 180.
120- */
121- attemptDeadlineSeconds ?: number | Expression < number > | ResetValue ;
122114
123115 /** The number of retry attempts for a failed run. */
124116 retryCount ?: number | Expression < number > | ResetValue ;
@@ -205,7 +197,17 @@ export function onSchedule(
205197 scheduleTrigger : initV2ScheduleTrigger ( separatedOpts . schedule , globalOpts , separatedOpts . opts ) ,
206198 } ;
207199
208- copyIfPresent ( ep . scheduleTrigger , separatedOpts , "timeZone" , "attemptDeadlineSeconds" ) ;
200+ copyIfPresent ( ep . scheduleTrigger , separatedOpts , "timeZone" ) ;
201+ if ( ep . timeoutSeconds ) {
202+ if ( typeof ep . timeoutSeconds === "number" ) {
203+ ep . scheduleTrigger . attemptDeadlineSeconds = Math . min ( ep . timeoutSeconds , 1800 ) ;
204+ } else {
205+ // For Expressions, we can't easily cap it here, but Cloud Scheduler will reject it if it's too high.
206+ // We'll pass it through and let the backend handle validation if possible, or just set it.
207+ // Given the constraints of Expressions, we'll just set it to the expression.
208+ ep . scheduleTrigger . attemptDeadlineSeconds = ep . timeoutSeconds ;
209+ }
210+ }
209211 copyIfPresent (
210212 ep . scheduleTrigger . retryConfig ,
211213 separatedOpts . retryConfig ,
0 commit comments