OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
improve(buffer): understand better if checksum is broken or not
Carl-Gerhard Lindesvärd77365391c29c
diff --git a/packages/db/src/buffers/profile-buffer-psql.ts b/packages/db/src/buffers/profile-buffer-psql.tsindex 1883015d6..0ad130c05 100644--- a/packages/db/src/buffers/profile-buffer-psql.ts+++ b/packages/db/src/buffers/profile-buffer-psql.ts@@ -113,6 +113,10 @@ export class ProfileBuffer extends BaseBuffer {} else if (existingProfile.payload) {this.logger.debug('Profile in buffer is different, merging', {profileId: profile.id,+ existingProfile: existingProfile.payload,+ existingProfileChecksum: existingProfile.checksum,+ incomingProfile: profile,+ incomingProfileChecksum: checksum,});mergedProfile = mergeDeepRight(existingProfile.payload, profile);}@@ -154,6 +158,12 @@ export class ProfileBuffer extends BaseBuffer {FROM ${TABLE_NAMES.profiles}WHERE project_id = '${profile.project_id}'AND id = '${profile.id}'+ ${+ // If profile is not external, we know its not older than 2 day+ profile.is_external === false+ ? 'AND created_at > now() - INTERVAL 2 DAY'+ : ''+ }ORDER BY created_at DESCLIMIT 1`,);