fix(buffer): fixed issues with buffer

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-18 23:45:05 +02:00
parent 3ca3079737
commit e18ac4d79e
2 changed files with 13 additions and 4 deletions

View File

@@ -67,7 +67,8 @@ export class EventBuffer extends RedisBuffer<BufferType> {
return (
lastEvent.project_id === item.project_id &&
lastEvent.profile_id === item.profile_id &&
lastEvent.path !== ''
lastEvent.path !== '' &&
lastEvent.name === 'screen_view'
);
});
@@ -76,6 +77,10 @@ export class EventBuffer extends RedisBuffer<BufferType> {
item,
);
if (!event.properties) {
event.properties = {};
}
if (lastEventWithData) {
event.properties.__properties_from = lastEventWithData.id;
}
@@ -114,9 +119,12 @@ export class EventBuffer extends RedisBuffer<BufferType> {
new Date(item.created_at).getTime();
const event = {
...item,
properties: {
...(item?.properties || {}),
__duration_from: nextScreenView.id,
},
duration,
};
event.properties.__duration_from = nextScreenView.id;
toInsert.add(event);
} else if (hasSessionEnd) {
// push last event in session if we have a session_end event