OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
chore(api): add option to not add new jobs
Carl-Gerhard Lindesvärd2688a428d958
diff --git a/apps/api/src/controllers/event.controller.ts b/apps/api/src/controllers/event.controller.tsindex 24e9eb1ea..189c66a51 100644--- a/apps/api/src/controllers/event.controller.ts+++ b/apps/api/src/controllers/event.controller.ts@@ -49,31 +49,34 @@ export async function postEvent('NX',);- eventsQueue.add(- 'event',- {- type: 'incomingEvent',- payload: {- projectId,- headers: getStringHeaders(request.headers),- event: {- ...request.body,- timestamp: timestamp.timestamp,- isTimestampFromThePast: timestamp.isTimestampFromThePast,+ // TODO: remove this+ if (process.env.DISABLE_ADD_JOBS === undefined) {+ eventsQueue.add(+ 'event',+ {+ type: 'incomingEvent',+ payload: {+ projectId,+ headers: getStringHeaders(request.headers),+ event: {+ ...request.body,+ timestamp: timestamp.timestamp,+ isTimestampFromThePast: 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: request.body.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: request.body.name === 'screen_view' ? undefined : 1000,+ },+ );+ }reply.status(202).send('ok');}diff --git a/apps/api/src/controllers/track.controller.ts b/apps/api/src/controllers/track.controller.tsindex 34b6fc90d..b893f3fd0 100644--- a/apps/api/src/controllers/track.controller.ts+++ b/apps/api/src/controllers/track.controller.ts@@ -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({