chore(api): add option to not add new jobs

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-02-08 22:13:16 +01:00
parent 6cc3bea802
commit 2688a428d9
2 changed files with 52 additions and 46 deletions

View File

@@ -247,31 +247,34 @@ async function track({
'NX',
);
eventsQueue.add(
'event',
{
type: 'incomingEvent',
payload: {
projectId,
headers,
event: {
...payload,
timestamp,
isTimestampFromThePast,
// TODO: remove this
if (process.env.DISABLE_ADD_JOBS === undefined) {
eventsQueue.add(
'event',
{
type: 'incomingEvent',
payload: {
projectId,
headers,
event: {
...payload,
timestamp,
isTimestampFromThePast,
},
geo,
currentDeviceId,
previousDeviceId,
priority: locked === 'OK',
},
geo,
currentDeviceId,
previousDeviceId,
priority: locked === 'OK',
},
},
{
// Prioritize 'screen_view' events by setting no delay
// This ensures that session starts are created from 'screen_view' events
// rather than other events, maintaining accurate session tracking
delay: payload.name === 'screen_view' ? undefined : 1000,
},
);
{
// Prioritize 'screen_view' events by setting no delay
// This ensures that session starts are created from 'screen_view' events
// rather than other events, maintaining accurate session tracking
delay: payload.name === 'screen_view' ? undefined : 1000,
},
);
}
}
async function identify({