Skip to content

Commit 4c462b8

Browse files
committed
Fix bug where reset keys were based on fn opt not endpoint.
1 parent 3765ebf commit 4c462b8

File tree

4 files changed

+33
-26
lines changed

4 files changed

+33
-26
lines changed

src/common/providers/tasks.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import * as logger from "../../logger";
2727
import * as https from "./https";
2828
import { Expression } from "../../params";
2929
import { ResettableKeys, ResetValue } from "../options";
30+
import { ManifestEndpoint } from "../../runtime/manifest";
3031

3132
/** How a task should be retried in the event of a non-2xx return. */
3233
export interface RetryConfig {
@@ -109,7 +110,9 @@ type v1TaskHandler = (data: any, context: TaskContext) => void | Promise<void>;
109110
type v2TaskHandler<Req> = (request: Request<Req>) => void | Promise<void>;
110111

111112
/** @internal */
112-
export const RESETTABLE_RETRY_CONFIG_OPTIONS: ResettableKeys<RetryConfig> = {
113+
export const RESETTABLE_RETRY_CONFIG_OPTIONS: ResettableKeys<
114+
ManifestEndpoint["taskQueueTrigger"]["retryConfig"]
115+
> = {
113116
maxAttempts: null,
114117
maxDoublings: null,
115118
maxBackoffSeconds: null,
@@ -118,7 +121,9 @@ export const RESETTABLE_RETRY_CONFIG_OPTIONS: ResettableKeys<RetryConfig> = {
118121
};
119122

120123
/** @internal */
121-
export const RESETTABLE_RATE_LIMITS_OPTIONS: ResettableKeys<RateLimits> = {
124+
export const RESETTABLE_RATE_LIMITS_OPTIONS: ResettableKeys<
125+
ManifestEndpoint["taskQueueTrigger"]["rateLimits"]
126+
> = {
122127
maxConcurrentDispatches: null,
123128
maxDispatchesPerSecond: null,
124129
};

src/v1/cloud-functions.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,29 @@
2222

2323
import { Request, Response } from "express";
2424
import { warn } from "../logger";
25-
import {
26-
DeploymentOptions,
27-
RESET_VALUE,
28-
RESETTABLE_SCHEDULE_OPTIONS,
29-
} from "./function-configuration";
25+
import { DeploymentOptions, RESET_VALUE } from "./function-configuration";
3026
export { Request, Response };
3127
import { convertIfPresent, copyIfPresent } from "../common/encoding";
3228
import { ManifestEndpoint, ManifestRequiredAPI } from "../runtime/manifest";
33-
import { RESETTABLE_OPTIONS, ResetValue } from "../common/options";
29+
import { RESETTABLE_OPTIONS, ResettableKeys, ResetValue } from "../common/options";
3430

3531
export { Change } from "../common/change";
3632

3733
/** @internal */
3834
const WILDCARD_REGEX = new RegExp("{[^/{}]*}", "g");
3935

36+
/** @internal */
37+
export const RESETTABLE_SCHEDULE_OPTIONS: Omit<
38+
ResettableKeys<ManifestEndpoint["scheduleTrigger"]["retryConfig"]>,
39+
"maxBackoffSeconds" | "minBackoffSeconds" | "maxRetrySeconds"
40+
> = {
41+
retryCount: null,
42+
maxDoublings: null,
43+
maxRetryDuration: null,
44+
maxBackoffDuration: null,
45+
minBackoffDuration: null,
46+
};
47+
4048
/**
4149
* Wire format for an event.
4250
*/

src/v1/function-configuration.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Expression } from "../params";
2-
import { ResettableKeys, ResetValue } from "../common/options";
2+
import { ResetValue } from "../common/options";
33

44
export { RESET_VALUE } from "../common/options";
55

@@ -266,12 +266,3 @@ export interface DeploymentOptions extends RuntimeOptions {
266266
*/
267267
preserveExternalChanges?: boolean;
268268
}
269-
270-
/** @internal */
271-
export const RESETTABLE_SCHEDULE_OPTIONS: ResettableKeys<ScheduleRetryConfig> = {
272-
retryCount: null,
273-
maxBackoffDuration: null,
274-
maxDoublings: null,
275-
maxRetryDuration: null,
276-
minBackoffDuration: null,
277-
};

src/v2/providers/scheduler.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import * as express from "express";
2424

2525
import { copyIfPresent } from "../../common/encoding";
26-
import { ResetValue } from "../../common/options";
26+
import { ResettableKeys, ResetValue } from "../../common/options";
2727
import { timezone } from "../../common/timezone";
2828
import { ManifestEndpoint, ManifestRequiredAPI } from "../../runtime/manifest";
2929
import { HttpsFunction } from "./https";
@@ -118,13 +118,16 @@ export interface ScheduleOptions extends options.GlobalOptions {
118118
maxDoublings?: number | Expression<number> | ResetValue;
119119
}
120120

121-
const RESETTABLE_SCHEDULE_OPTIONS: Array<keyof ScheduleOptions> = [
122-
"retryCount",
123-
"maxRetrySeconds",
124-
"minBackoffSeconds",
125-
"maxBackoffSeconds",
126-
"maxDoublings",
127-
];
121+
const RESETTABLE_SCHEDULE_OPTIONS: Omit<
122+
ResettableKeys<ManifestEndpoint["scheduleTrigger"]["retryConfig"]>,
123+
"maxRetryDuration" | "maxBackoffDuration" | "minBackoffDuration"
124+
> = {
125+
retryCount: null,
126+
maxDoublings: null,
127+
maxRetrySeconds: null,
128+
minBackoffSeconds: null,
129+
maxBackoffSeconds: null,
130+
};
128131

129132
/**
130133
* Handler for scheduled functions. Triggered whenever the associated

0 commit comments

Comments
 (0)