Skip to content

Conversation

@taeold
Copy link
Contributor

@taeold taeold commented Nov 14, 2025

Adds new configurable option attemptDeadlineSeconds to v2 scheduled function configuration.

Per Cloud Scheduler docs

The deadline for job attempts. If the request handler does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. The failed attempt can be viewed in execution logs. Cloud Scheduler will retry the job according to the RetryConfig.

For HTTP targets, the default is 3 minutes. The deadline must be in the interval [15 seconds, 30 minutes].

This option is useful for customer migrating from v1 scheduled function. V1 Scheduled function relied on pubsub for event delivery, which defaults to 10m ack deadline (~= attempt deadline).

  export const myScheduledFunction = onSchedule({
    schedule: "every 5 minutes",
    attemptDeadlineSeconds: 300,
    retryCount: 3
  }, (event) => {
    // Your function logic
  });

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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 introduces the attemptDeadlineSeconds option for v2 scheduled functions, allowing users to specify a maximum duration for a job attempt. This feature provides greater control over the execution of scheduled tasks by enabling the definition of a deadline, which can help manage resource usage and prevent long-running or stuck jobs. The changes involve updating relevant data structures and logic across the codebase to properly incorporate and utilize this new configuration, supported by new test cases.

Highlights

  • Introduced attemptDeadlineSeconds: A new configuration option has been added for v2 scheduled functions, allowing users to specify a deadline for job attempts.
  • Updated Core Interfaces: The ManifestEndpoint and ScheduleOptions interfaces have been updated to include the new attemptDeadlineSeconds parameter.
  • Enhanced initV2ScheduleTrigger Logic: The initV2ScheduleTrigger function now explicitly handles and sets the attemptDeadlineSeconds reset value for v2 functions, ensuring consistent behavior.
  • Integrated into Function Options: The getOpts and onSchedule functions have been modified to correctly extract, process, and apply the attemptDeadlineSeconds value during scheduled function configuration.
  • Comprehensive Test Coverage: New and updated tests have been added to validate the correct implementation and functionality of the attemptDeadlineSeconds option across various scenarios.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for attemptDeadlineSeconds to v2 scheduled functions. The changes are well-implemented across interfaces, options handling, and tests. I have one suggestion to improve the implementation in initV2ScheduleTrigger by avoiding a redundant check, which will make the code cleaner and more maintainable.

@taeold taeold changed the title Add attemptDeadlineSeconds support to v2 scheduled functions feat: add attemptDeadlineSeconds support to v2 scheduled functions Nov 14, 2025
@taeold taeold force-pushed the add-attempt-deadline-seconds-v2-schedule branch from c1c4629 to 142dd60 Compare November 14, 2025 03:23
@taeold taeold closed this Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant