Skip to content

Commit

Permalink
Fix retry in event triggers (#1463)
Browse files Browse the repository at this point in the history
* fix retry in event triggers

* changelog

* fix tests

* Use nullish coalescing instea of logical or.

---------

Co-authored-by: Daniel Lee <danielylee@google.com>
Co-authored-by: Daniel Lee <taeold@gmail.com>
  • Loading branch information
3 people authored Aug 23, 2024
1 parent 95ae33f commit 2358cc1
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Fix retry in event triggered functions. (#1463)
- Expose retry configuration in v2 RTDB trigger (#1588)
2 changes: 1 addition & 1 deletion src/v2/providers/alerts/alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export function getEndpointAnnotation(
eventFilters: {
alerttype: alertType,
},
retry: !!opts.retry,
retry: opts.retry ?? false,
},
};
if (appId) {
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/eventarc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export function onCustomEventPublished<T = any>(
eventTrigger: {
eventType: opts.eventType,
eventFilters: {},
retry: false,
retry: opts.retry ?? false,
channel,
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/firestore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ export function makeEndpoint(
eventType,
eventFilters,
eventFilterPathPatterns,
retry: !!opts.retry,
retry: opts.retry ?? false,
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export function onMessagePublished<T = any>(
eventTrigger: {
eventType: "google.cloud.pubsub.topic.v1.messagePublished",
eventFilters: { topic },
retry: false,
retry: opts.retry ?? false,
},
};
copyIfPresent(endpoint.eventTrigger, opts, "retry", "retry");
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/remoteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ export function onConfigUpdated(
eventTrigger: {
eventType,
eventFilters: {},
retry: !!optsOrHandler.retry,
retry: optsOrHandler.retry ?? false,
},
};
func.__endpoint = ep;
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ export function onOperation(
eventTrigger: {
eventType,
eventFilters: { bucket },
retry: false,
retry: opts.retry ?? false,
},
};
copyIfPresent(endpoint.eventTrigger, opts, "retry", "retry");
Expand Down
1 change: 1 addition & 0 deletions src/v2/providers/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export function onTaskDispatched<Args = any>(
convertInvoker
);
convertIfPresent(func.__endpoint.taskQueueTrigger, opts, "invoker", "invoker", convertInvoker);
copyIfPresent(func.__endpoint.taskQueueTrigger, opts, "retry", "retry");

func.__requiredAPIs = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/v2/providers/testLab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function onTestMatrixCompleted(
eventTrigger: {
eventType,
eventFilters: {},
retry: !!optsOrHandler.retry,
retry: optsOrHandler.retry ?? false,
},
};
func.__endpoint = ep;
Expand Down

0 comments on commit 2358cc1

Please sign in to comment.