File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -869,6 +869,7 @@ def _endpoint(
869869 schedule = self .schedule ,
870870 timeZone = time_zone ,
871871 retryConfig = retry_config ,
872+ attemptDeadlineSeconds = self .timeout_sec ,
872873 ),
873874 }
874875 return _manifest .ManifestEndpoint (** _typing .cast (dict , kwargs_merged ))
Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ class ScheduleTrigger(_typing.TypedDict):
125125 schedule : str | _params .Expression [str ]
126126 timeZone : str | _params .Expression [str ] | _util .Sentinel | None
127127 retryConfig : RetryConfigScheduler | None
128+ attemptDeadlineSeconds : int | _params .Expression [int ] | _util .Sentinel | None
128129
129130
130131class BlockingTriggerOptions (_typing .TypedDict ):
Original file line number Diff line number Diff line change @@ -47,6 +47,18 @@ def test_on_schedule_decorator(self):
4747 self .assertEqual (endpoint .scheduleTrigger .get ("schedule" ), schedule )
4848 self .assertEqual (endpoint .scheduleTrigger .get ("timeZone" ), tz )
4949
50+ def test_on_schedule_with_timeout (self ):
51+ """
52+ Tests that attemptDeadlineSeconds is set to timeoutSeconds.
53+ """
54+ decorated_func = scheduler_fn .on_schedule (
55+ schedule = "* * * * *" ,
56+ timeout_sec = 120 ,
57+ )(Mock (__name__ = "example_func" ))
58+ endpoint = decorated_func .__firebase_endpoint__
59+ self .assertEqual (endpoint .timeoutSeconds , 120 )
60+ self .assertEqual (endpoint .scheduleTrigger .get ("attemptDeadlineSeconds" ), 120 )
61+
5062 def test_on_schedule_call (self ):
5163 """
5264 Tests to ensure the decorated function is called correctly
You can’t perform that action at this time.
0 commit comments