0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 11:17:50 +01:00

fix(cdp): Handle if there are no logs (#24053)

This commit is contained in:
Ben White 2024-07-29 18:31:35 +02:00 committed by GitHub
parent 093559fb92
commit 526c96e8a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -170,6 +170,10 @@ export const prepareLogEntriesForClickhouse = (
const sortedLogs = logs.sort((a, b) => a.timestamp.toMillis() - b.timestamp.toMillis())
if (sortedLogs.length === 0) {
return []
}
// Start with a timestamp that is guaranteed to be before the first log entry
let previousTimestamp = sortedLogs[0].timestamp.minus(1)