Skip to content

Commit

Permalink
Merge branch 'master' into sam/25_01_08/fix/docker-image
Browse files Browse the repository at this point in the history
  • Loading branch information
bodinsamuel authored Jan 8, 2025
2 parents 4cfd4b0 + c5e9fb2 commit ed90ce9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/jobs/lib/execution/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ export async function handleSyncSuccess({ nangoProps }: { nangoProps: NangoProps
for (const model of nangoProps.syncConfig.models) {
let deletedKeys: string[] = [];
if (nangoProps.syncConfig.track_deletes) {
deletedKeys = await records.markNonCurrentGenerationRecordsAsDeleted({
deletedKeys = await records.markPreviousGenerationRecordsAsDeleted({
connectionId: nangoProps.nangoConnectionId,
model,
syncId: nangoProps.syncId,
Expand Down
8 changes: 3 additions & 5 deletions packages/records/lib/models/records.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,9 @@ export async function deleteRecordCount({ connectionId, environmentId, model }:
await db.from(RECORD_COUNTS_TABLE).where({ connection_id: connectionId, environment_id: environmentId, model }).del();
}

// Mark all non-deleted records that don't belong to currentGeneration as deleted
// Mark all non-deleted records from previous generations as deleted
// returns the ids of records being deleted
export async function markNonCurrentGenerationRecordsAsDeleted({
export async function markPreviousGenerationRecordsAsDeleted({
connectionId,
model,
syncId,
Expand All @@ -471,9 +471,7 @@ export async function markNonCurrentGenerationRecordsAsDeleted({
sync_id: syncId,
deleted_at: null
})
.whereNot({
sync_job_id: generation
})
.where('sync_job_id', '<', generation)
.update({
deleted_at: now,
updated_at: now,
Expand Down

0 comments on commit ed90ce9

Please sign in to comment.