From 53df4097a67d33d10f3ad6eb3f973be1e2dc4571 Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 24 Aug 2022 11:21:16 -0700 Subject: [PATCH 1/2] Add docs on schedule configs. --- src/v1/function-configuration.ts | 52 ++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/src/v1/function-configuration.ts b/src/v1/function-configuration.ts index ca255b58a..4ab6fb96c 100644 --- a/src/v1/function-configuration.ts +++ b/src/v1/function-configuration.ts @@ -72,10 +72,37 @@ export const INGRESS_SETTINGS_OPTIONS = [ * Scheduler retry options. Applies only to scheduled functions. */ export interface ScheduleRetryConfig { + /** + * The number of attempts that the system will make to run a job using the exponential backoff procedure described by {@link ScheduleRetryConfig.maxDoublings}. + * + * @defaultValue 0 (infinite retry) + */ retryCount?: number; + /** + * The time limit for retrying a failed job, measured from time when an execution was first attempted. + * + * If specified with {@link ScheduleRetryConfig.retryCount}, the job will be retried until both limits are reached. + * + * @defaultValue 0 + */ maxRetryDuration?: string; + /** + * The minimum amount of time to wait before retrying a job after it fails. + * + * @defaultValue 5 seconds + */ minBackoffDuration?: string; + /** + * The maximum amount of time to wait before retrying a job after it fails. + * + * @defaultValue 1 hour + */ maxBackoffDuration?: string; + /** + * The max number of backoff doubling applied at each retry. + * + * @defaultValue 5 + */ maxDoublings?: number; } @@ -83,8 +110,33 @@ export interface ScheduleRetryConfig { * Configuration options for scheduled functions. */ export interface Schedule { + /** + * Describes the schedule on which the job will be executed. + * + * The schedule can be either of the following types: + * + * 1. {@link https://en.wikipedia.org/wiki/Cron#Overview | Crontab} + * + * 2. English-like {@link https://cloud.google.com/scheduler/docs/configuring/cron-job-schedules | schedule} + * + * @example + * ``` + * // Crontab schedule + * schedule: "0 9 * * 1"` // Every Monday at 09:00 AM + * // Englihsh-like schedule + * schedule: "every 5 minutes" + * ``` + */ schedule: string; + /** + * Specifies the time zone to be used in interpreting {@link Schedule.schedule}. + * + * The value of this field must be a time zone name from the tz database. + */ timeZone?: string; + /** + * Settings that determine the retry behavior. + */ retryConfig?: ScheduleRetryConfig; } From 27f3da3d481d181948930723e61aa6c6741448ca Mon Sep 17 00:00:00 2001 From: Daniel Young Lee Date: Wed, 24 Aug 2022 11:22:55 -0700 Subject: [PATCH 2/2] Fix typo. --- src/v1/function-configuration.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/v1/function-configuration.ts b/src/v1/function-configuration.ts index 4ab6fb96c..b66eaf3c5 100644 --- a/src/v1/function-configuration.ts +++ b/src/v1/function-configuration.ts @@ -123,7 +123,8 @@ export interface Schedule { * ``` * // Crontab schedule * schedule: "0 9 * * 1"` // Every Monday at 09:00 AM - * // Englihsh-like schedule + * + * // English-like schedule * schedule: "every 5 minutes" * ``` */