Skip to content

Commit

Permalink
fix(firebase): Reducing gap to refresh apiDoc on API events PubSub …
Browse files Browse the repository at this point in the history
…middlewares to 600ms
  • Loading branch information
leomp12 committed Nov 26, 2024
1 parent af1ede3 commit 658ed51
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/firebase/src/helpers/pubsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ const createAppEventsFunction = (
} = payload;
logger.info(`ev/${evName} ${resourceId} at ${timestamp}`, {
modifiedFields: payload.apiEvent.modified_fields,
datasetAt: payload.at,
});
if (resource && payload.at && Date.now() - payload.at > 2000) {
if (resource && payload.at && Date.now() - payload.at > 600) {
const { data: apiDoc } = await api.get(`${resource as 'orders'}/${resourceId}`);
if (!((payload.apiDoc as Orders).updated_at > apiDoc.updated_at)) {
payload.apiDoc = apiDoc;
Expand Down

0 comments on commit 658ed51

Please # to comment.