Skip to content

Commit

Permalink
fix:do not skip adding of published record to `ddbEsItemsToBatchRead (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j authored Aug 21, 2024
1 parent 7bb3196 commit c5e2e7b
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions packages/migrations/src/migrations/5.39.6/001/ddb-es/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,21 +278,22 @@ if (process.env.WEBINY_MIGRATION_5_39_6_001_BATCH_WRITE_MAX_CHUNK) {
*/

const ddbEsLatestRecordKey = `${item.entryId}:L`;
if (ddbEsItemsToBatchRead[ddbEsLatestRecordKey]) {
continue;
if (!ddbEsItemsToBatchRead[ddbEsLatestRecordKey]) {
ddbEsItemsToBatchRead[ddbEsLatestRecordKey] = ddbEsEntryEntity.getBatch({
PK: item.PK,
SK: "L"
});
}

ddbEsItemsToBatchRead[ddbEsLatestRecordKey] = ddbEsEntryEntity.getBatch({
PK: item.PK,
SK: "L"
});

const ddbEsPublishedRecordKey = `${item.entryId}:P`;
if (item.status === "published" || !!item.locked) {
ddbEsItemsToBatchRead[ddbEsPublishedRecordKey] = ddbEsEntryEntity.getBatch({
PK: item.PK,
SK: "P"
});
if (!ddbEsItemsToBatchRead[ddbEsPublishedRecordKey]) {
if (item.status === "published" || !!item.locked) {
ddbEsItemsToBatchRead[ddbEsPublishedRecordKey] =
ddbEsEntryEntity.getBatch({
PK: item.PK,
SK: "P"
});
}
}
}

Expand Down

0 comments on commit c5e2e7b

Please sign in to comment.