From 658ed51867af6980606466dbc2f3a3b6ea5ec53f Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Tue, 26 Nov 2024 14:05:21 -0300 Subject: [PATCH] fix(firebase): Reducing gap to refresh `apiDoc` on API events PubSub middlewares to 600ms --- packages/firebase/src/helpers/pubsub.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/firebase/src/helpers/pubsub.ts b/packages/firebase/src/helpers/pubsub.ts index 5bb8300d4..297cfc4fa 100644 --- a/packages/firebase/src/helpers/pubsub.ts +++ b/packages/firebase/src/helpers/pubsub.ts @@ -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;