Skip to content

Commit 579a26e

Browse files
committed
refactor: change level attemptDeadline same as timeZone level for api
1 parent d20a80f commit 579a26e

File tree

8 files changed

+14
-21
lines changed

8 files changed

+14
-21
lines changed

spec/runtime/manifest.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,13 @@ describe("initScheduleTrigger", () => {
259259
expect(st).to.deep.eq({
260260
schedule: "every 30 minutes",
261261
timeZone: RESET_VALUE,
262+
attemptDeadline: RESET_VALUE,
262263
retryConfig: {
263264
retryCount: RESET_VALUE,
264265
maxDoublings: RESET_VALUE,
265266
maxRetryDuration: RESET_VALUE,
266267
minBackoffDuration: RESET_VALUE,
267268
maxBackoffDuration: RESET_VALUE,
268-
attemptDeadline: RESET_VALUE,
269269
},
270270
});
271271
});
@@ -287,13 +287,13 @@ describe("initScheduleTrigger", () => {
287287
expect(st).to.deep.eq({
288288
schedule: "every 30 minutes",
289289
timeZone: RESET_VALUE,
290+
attemptDeadline: RESET_VALUE,
290291
retryConfig: {
291292
retryCount: RESET_VALUE,
292293
maxDoublings: RESET_VALUE,
293294
maxRetrySeconds: RESET_VALUE,
294295
minBackoffSeconds: RESET_VALUE,
295296
maxBackoffSeconds: RESET_VALUE,
296-
attemptDeadline: RESET_VALUE,
297297
},
298298
});
299299
});

spec/v1/cloud-functions.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,13 @@ describe("makeCloudFunction", () => {
206206
platform: "gcfv1",
207207
scheduleTrigger: {
208208
...schedule,
209+
attemptDeadline: RESET_VALUE,
209210
retryConfig: {
210211
...schedule.retryConfig,
211212
maxBackoffDuration: RESET_VALUE,
212213
maxDoublings: RESET_VALUE,
213214
maxRetryDuration: RESET_VALUE,
214215
minBackoffDuration: RESET_VALUE,
215-
attemptDeadline: RESET_VALUE,
216216
},
217217
},
218218
labels: {},

spec/v1/providers/fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,6 @@ export const MINIMAL_SCHEDULE_TRIGGER: ManifestEndpoint["scheduleTrigger"] = {
4646
maxBackoffDuration: options.RESET_VALUE,
4747
minBackoffDuration: options.RESET_VALUE,
4848
maxDoublings: options.RESET_VALUE,
49-
attemptDeadline: options.RESET_VALUE,
5049
},
50+
attemptDeadline: options.RESET_VALUE,
5151
};

spec/v1/providers/pubsub.spec.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@ describe("Pubsub Functions", () => {
217217
schedule: "every 5 minutes",
218218
retryConfig: {
219219
...retryConfig,
220-
attemptDeadline: RESET_VALUE,
221220
},
222221
});
223222
expect(result.__endpoint.labels).to.be.empty;
@@ -254,7 +253,6 @@ describe("Pubsub Functions", () => {
254253
schedule: "every 5 minutes",
255254
retryConfig: {
256255
...retryConfig,
257-
attemptDeadline: RESET_VALUE,
258256
},
259257
timeZone: "America/New_York",
260258
});
@@ -349,7 +347,6 @@ describe("Pubsub Functions", () => {
349347
timeZone: RESET_VALUE,
350348
retryConfig: {
351349
...retryConfig,
352-
attemptDeadline: RESET_VALUE,
353350
},
354351
});
355352
expect(result.__endpoint.region).to.deep.equal(["us-east1"]);
@@ -393,7 +390,6 @@ describe("Pubsub Functions", () => {
393390
timeZone: "America/New_York",
394391
retryConfig: {
395392
...retryConfig,
396-
attemptDeadline: RESET_VALUE,
397393
},
398394
});
399395
expect(result.__endpoint.region).to.deep.equal(["us-east1"]);

spec/v2/providers/scheduler.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ const MINIMAL_SCHEDULE_TRIGGER: ManifestEndpoint["scheduleTrigger"] = {
3838
minBackoffSeconds: options.RESET_VALUE,
3939
maxBackoffSeconds: options.RESET_VALUE,
4040
maxDoublings: options.RESET_VALUE,
41-
attemptDeadline: options.RESET_VALUE,
4241
},
42+
attemptDeadline: options.RESET_VALUE,
4343
};
4444

4545
describe("schedule", () => {
@@ -74,8 +74,8 @@ describe("schedule", () => {
7474
minBackoffSeconds: 2,
7575
maxBackoffSeconds: 3,
7676
maxDoublings: 4,
77-
attemptDeadline: "120s",
7877
},
78+
attemptDeadline: "120s",
7979
opts: {
8080
...options,
8181
memory: "128MiB",
@@ -115,7 +115,7 @@ describe("schedule", () => {
115115
() => undefined
116116
);
117117

118-
expect(schfn.__endpoint.scheduleTrigger?.retryConfig?.attemptDeadline).to.equal(
118+
expect(schfn.__endpoint.scheduleTrigger?.attemptDeadline).to.equal(
119119
"320s"
120120
);
121121
});
@@ -151,8 +151,8 @@ describe("schedule", () => {
151151
minBackoffSeconds: 11,
152152
maxBackoffSeconds: 12,
153153
maxDoublings: 2,
154-
attemptDeadline: "120s",
155154
},
155+
attemptDeadline: "120s",
156156
},
157157
});
158158
expect(schfn.__requiredAPIs).to.deep.eq([
@@ -178,13 +178,13 @@ describe("schedule", () => {
178178
scheduleTrigger: {
179179
schedule: "* * * * *",
180180
timeZone: undefined,
181+
attemptDeadline: undefined,
181182
retryConfig: {
182183
retryCount: undefined,
183184
maxRetrySeconds: undefined,
184185
minBackoffSeconds: undefined,
185186
maxBackoffSeconds: undefined,
186187
maxDoublings: undefined,
187-
attemptDeadline: undefined,
188188
},
189189
},
190190
});

src/runtime/manifest.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ export interface ManifestEndpoint {
107107
maxRetryDuration?: string | Expression<string> | ResetValue;
108108
minBackoffDuration?: string | Expression<string> | ResetValue;
109109
maxBackoffDuration?: string | Expression<string> | ResetValue;
110-
attemptDeadline?: string | Expression<string> | ResetValue;
111110
};
111+
attemptDeadline?: string | Expression<string> | ResetValue;
112112
};
113113

114114
blockingTrigger?: {
@@ -255,7 +255,6 @@ const RESETTABLE_V1_SCHEDULE_OPTIONS: Omit<
255255
maxRetryDuration: null,
256256
maxBackoffDuration: null,
257257
minBackoffDuration: null,
258-
attemptDeadline: null,
259258
};
260259

261260
const RESETTABLE_V2_SCHEDULE_OPTIONS: Omit<
@@ -267,7 +266,6 @@ const RESETTABLE_V2_SCHEDULE_OPTIONS: Omit<
267266
maxRetrySeconds: null,
268267
minBackoffSeconds: null,
269268
maxBackoffSeconds: null,
270-
attemptDeadline: null,
271269
};
272270

273271
function initScheduleTrigger(
@@ -283,7 +281,7 @@ function initScheduleTrigger(
283281
for (const key of Object.keys(resetOptions)) {
284282
scheduleTrigger.retryConfig[key] = RESET_VALUE;
285283
}
286-
scheduleTrigger = { ...scheduleTrigger, timeZone: RESET_VALUE };
284+
scheduleTrigger = { ...scheduleTrigger, timeZone: RESET_VALUE, attemptDeadline: RESET_VALUE };
287285
}
288286
return scheduleTrigger;
289287
}

src/v1/cloud-functions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,6 @@ export function makeCloudFunction<EventData>({
486486
"maxBackoffDuration",
487487
"maxRetryDuration",
488488
"minBackoffDuration",
489-
"attemptDeadline"
490489
);
491490
} else {
492491
endpoint.eventTrigger = {

src/v2/providers/scheduler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ interface SeparatedOpts {
4848
minBackoffSeconds?: number | Expression<number> | ResetValue;
4949
maxBackoffSeconds?: number | Expression<number> | ResetValue;
5050
maxDoublings?: number | Expression<number> | ResetValue;
51-
attemptDeadline?: string | Expression<string> | ResetValue;
5251
};
52+
attemptDeadline?: string | Expression<string> | ResetValue;
5353
opts: options.GlobalOptions;
5454
}
5555

@@ -71,8 +71,8 @@ export function getOpts(args: string | ScheduleOptions): SeparatedOpts {
7171
minBackoffSeconds: args.minBackoffSeconds,
7272
maxBackoffSeconds: args.maxBackoffSeconds,
7373
maxDoublings: args.maxDoublings,
74-
attemptDeadline: args.attemptDeadline,
7574
},
75+
attemptDeadline: args.attemptDeadline,
7676
opts: args as options.GlobalOptions,
7777
};
7878
}
@@ -206,6 +206,7 @@ export function onSchedule(
206206
};
207207

208208
copyIfPresent(ep.scheduleTrigger, separatedOpts, "timeZone");
209+
copyIfPresent(ep.scheduleTrigger, separatedOpts, "attemptDeadline");
209210
copyIfPresent(
210211
ep.scheduleTrigger.retryConfig,
211212
separatedOpts.retryConfig,
@@ -214,7 +215,6 @@ export function onSchedule(
214215
"minBackoffSeconds",
215216
"maxBackoffSeconds",
216217
"maxDoublings",
217-
"attemptDeadline"
218218
);
219219
func.__endpoint = ep;
220220

0 commit comments

Comments
 (0)