Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
fix: skip last modified at timestamps that are the same (#1888)
Browse files Browse the repository at this point in the history
## Test Plan

[Describe test plan here]

## Deployment instructions

[Add any special deployment instructions here]
  • Loading branch information
tomkit committed Nov 10, 2023
1 parent 8b7e101 commit ef162f7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/destination_writers/postgres_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ DO UPDATE SET (${columnsToUpdateStr}) = (${excludedColumnsToUpdateStr})`,
const dedupeKey = `${applicationId}__${providerName}__${customerId}__${unifiedData.id}`;
const existingLastModifiedAt = dedupeMap.get(dedupeKey);

if (existingLastModifiedAt && existingLastModifiedAt > lastModifiedAt) {
// Some providers have the same lastModifiedAt for multiple records
if (existingLastModifiedAt && existingLastModifiedAt >= lastModifiedAt) {
// skip this record, it's older than the existing one
return callback(null);
}
Expand Down Expand Up @@ -442,7 +443,8 @@ DO UPDATE SET (${columnsToUpdateStr}) = (${excludedColumnsToUpdateStr})`,
const dedupeKey = `${applicationId}__${providerName}__${customerId}__${record.id}__${objectName}`;
const existingLastModifiedAt = dedupeMap.get(dedupeKey);

if (existingLastModifiedAt && existingLastModifiedAt > lastModifiedAt) {
// Some providers have the same lastModifiedAt for multiple records
if (existingLastModifiedAt && existingLastModifiedAt >= lastModifiedAt) {
// skip this record, it's older than the existing one
return callback(null);
}
Expand Down

0 comments on commit ef162f7

Please sign in to comment.