improve(api): ensure we do 3 attempts to add events to the queue
This commit is contained in:
@@ -49,7 +49,7 @@ export async function postEvent(
|
|||||||
'NX',
|
'NX',
|
||||||
);
|
);
|
||||||
|
|
||||||
eventsQueue.add(
|
await eventsQueue.add(
|
||||||
'event',
|
'event',
|
||||||
{
|
{
|
||||||
type: 'incomingEvent',
|
type: 'incomingEvent',
|
||||||
@@ -68,6 +68,11 @@ export async function postEvent(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
attempts: 3,
|
||||||
|
backoff: {
|
||||||
|
type: 'exponential',
|
||||||
|
delay: 200,
|
||||||
|
},
|
||||||
// Prioritize 'screen_view' events by setting no delay
|
// Prioritize 'screen_view' events by setting no delay
|
||||||
// This ensures that session starts are created from 'screen_view' events
|
// This ensures that session starts are created from 'screen_view' events
|
||||||
// rather than other events, maintaining accurate session tracking
|
// rather than other events, maintaining accurate session tracking
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ async function track({
|
|||||||
'NX',
|
'NX',
|
||||||
);
|
);
|
||||||
|
|
||||||
eventsQueue.add(
|
await eventsQueue.add(
|
||||||
'event',
|
'event',
|
||||||
{
|
{
|
||||||
type: 'incomingEvent',
|
type: 'incomingEvent',
|
||||||
@@ -267,6 +267,11 @@ async function track({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
attempts: 3,
|
||||||
|
backoff: {
|
||||||
|
type: 'exponential',
|
||||||
|
delay: 200,
|
||||||
|
},
|
||||||
// Prioritize 'screen_view' events by setting no delay
|
// Prioritize 'screen_view' events by setting no delay
|
||||||
// This ensures that session starts are created from 'screen_view' events
|
// This ensures that session starts are created from 'screen_view' events
|
||||||
// rather than other events, maintaining accurate session tracking
|
// rather than other events, maintaining accurate session tracking
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ export async function createSessionEnd({
|
|||||||
{
|
{
|
||||||
delay: SESSION_TIMEOUT,
|
delay: SESSION_TIMEOUT,
|
||||||
jobId: getSessionEndJobId(payload.projectId, payload.deviceId),
|
jobId: getSessionEndJobId(payload.projectId, payload.deviceId),
|
||||||
|
attempts: 3,
|
||||||
|
backoff: {
|
||||||
|
type: 'exponential',
|
||||||
|
delay: 200,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user