fix(worker): minor improvements for incoming events
This commit is contained in:
@@ -63,10 +63,12 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
|||||||
const uaInfo = parseUserAgent(userAgent);
|
const uaInfo = parseUserAgent(userAgent);
|
||||||
|
|
||||||
if (uaInfo.isServer) {
|
if (uaInfo.isServer) {
|
||||||
const event = await getLastScreenViewFromProfileId({
|
const event = profileId
|
||||||
|
? await getLastScreenViewFromProfileId({
|
||||||
profileId,
|
profileId,
|
||||||
projectId,
|
projectId,
|
||||||
});
|
})
|
||||||
|
: null;
|
||||||
|
|
||||||
const payload: IServiceCreateEventPayload = {
|
const payload: IServiceCreateEventPayload = {
|
||||||
name: body.name,
|
name: body.name,
|
||||||
@@ -82,8 +84,8 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
|||||||
country: event?.country || geo.country || '',
|
country: event?.country || geo.country || '',
|
||||||
city: event?.city || geo.city || '',
|
city: event?.city || geo.city || '',
|
||||||
region: event?.region || geo.region || '',
|
region: event?.region || geo.region || '',
|
||||||
longitude: geo.longitude,
|
longitude: event?.longitude || geo.longitude || null,
|
||||||
latitude: geo.latitude,
|
latitude: event?.latitude || geo.latitude || null,
|
||||||
os: event?.os ?? '',
|
os: event?.os ?? '',
|
||||||
osVersion: event?.osVersion ?? '',
|
osVersion: event?.osVersion ?? '',
|
||||||
browser: event?.browser ?? '',
|
browser: event?.browser ?? '',
|
||||||
@@ -128,6 +130,7 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
|
|||||||
profileId,
|
profileId,
|
||||||
projectId,
|
projectId,
|
||||||
properties: Object.assign({}, omit(GLOBAL_PROPERTIES, properties), {
|
properties: Object.assign({}, omit(GLOBAL_PROPERTIES, properties), {
|
||||||
|
user_agent: userAgent,
|
||||||
__hash: hash,
|
__hash: hash,
|
||||||
__query: query,
|
__query: query,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user