feat: add attemptDeadlineSeconds support to scheduled functions#9464
feat: add attemptDeadlineSeconds support to scheduled functions#9464
Conversation
Summary of ChangesHello @taeold, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request integrates Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for attemptDeadlineSeconds to scheduled functions. The changes are well-structured, touching the necessary parts of the codebase from backend interfaces to the Cloud Scheduler integration, and include corresponding tests. However, I've identified a couple of issues where null values for attemptDeadlineSeconds are not handled correctly, which prevents clearing an existing deadline. My review includes suggestions to address these issues to make the feature more robust.
shettyvarun268
left a comment
There was a problem hiding this comment.
Changes reviewed and look good. Null case addressed. Ran the test case and passed.
…un scheduled functions.
Rollback #9464 Firebase CLI will now synchronizes Cloud Scheduler's attemptDeadline with the function's timeoutSeconds for v2 scheduled functions, capped at 1800 seconds. This is a change from original attempt where we tried to expose a new configuration for scheduled function that allowed users to directly set the attemptDeadline. We don't know why they would ever drift, so we'll simplify make sure the Scheduler's timeout is in sync with functions timeout. Note that Cloud Scheduler has an attempt deadline range of [15s, 1800s], and defaults to 180s. We floor at 180s to be safe, even if the function timeout is shorter. This is because GCF/Cloud Run will already terminate the function at its configured timeout, so Cloud Scheduler won't actually wait the full 180s unless GCF itself fails to respond. Setting it shorter than 180s might cause premature retries due to network latency.
Rollback #9464 Firebase CLI will now synchronizes Cloud Scheduler's attemptDeadline with the function's timeoutSeconds for v2 scheduled functions, capped at 1800 seconds. This is a change from original attempt where we tried to expose a new configuration for scheduled function that allowed users to directly set the attemptDeadline. We don't know why they would ever drift, so we'll simplify make sure the Scheduler's timeout is in sync with functions timeout. Note that Cloud Scheduler has an attempt deadline range of [15s, 1800s], and defaults to 180s. We floor at 180s to be safe, even if the function timeout is shorter. This is because GCF/Cloud Run will already terminate the function at its configured timeout, so Cloud Scheduler won't actually wait the full 180s unless GCF itself fails to respond. Setting it shorter than 180s might cause premature retries due to network latency.
This PR adds support for
attemptDeadlineSecondsin scheduled functions, allowing users to configure the deadline for job attempts. This mirrors the recent changes in the Functions SDK.Changes
ScheduleTriggerinbackend.tsandbuild.ts.Jobinterface andjobFromEndpointincloudscheduler.ts.v1alpha1.tsto parseattemptDeadlineSecondsfrom discovery.