fix(session): negative duration
This commit is contained in:
@@ -55,6 +55,12 @@ export class SessionBuffer extends BaseBuffer {
|
|||||||
newSession.duration =
|
newSession.duration =
|
||||||
new Date(newSession.ended_at).getTime() -
|
new Date(newSession.ended_at).getTime() -
|
||||||
new Date(newSession.created_at).getTime();
|
new Date(newSession.created_at).getTime();
|
||||||
|
if (newSession.duration < 0) {
|
||||||
|
this.logger.warn('Session duration is negative', {
|
||||||
|
session: newSession,
|
||||||
|
});
|
||||||
|
newSession.duration = 0;
|
||||||
|
}
|
||||||
newSession.properties = toDots({
|
newSession.properties = toDots({
|
||||||
...(event.properties || {}),
|
...(event.properties || {}),
|
||||||
...(newSession.properties || {}),
|
...(newSession.properties || {}),
|
||||||
|
|||||||
Reference in New Issue
Block a user