Skip to content

Commit

Permalink
feat: minor logging improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
wwills2 committed Sep 23, 2024
1 parent b8e2529 commit 0408228
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/tasks/sync-registries.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ const syncOrganizationAudit = async (organization) => {
logger.debug(`querying datalayer for ${organization.name} root history`);
const rootHistory = await datalayer.getRootHistory(organization.registryId);

if (!rootHistory.length) {
if (!rootHistory?.length) {
logger.warn(
`No root history found for ${organization.name} (store ${organization.orgUid})`,
`Could not find root history for ${organization.name} (orgUid ${organization.orgUid}) with timestamp ${currentGeneration.timestamp}, something is wrong and the sync for this organization will be paused until this is resolved.`,
);
return;
}
Expand Down Expand Up @@ -258,13 +258,6 @@ const syncOrganizationAudit = async (organization) => {
`1 Last processed index of ${organization.name}: ${lastProcessedIndex}`,
);

if (!rootHistory?.length) {
logger.error(
`Could not find root history for ${organization.name} (store ${organization.orgUid}) with timestamp ${currentGeneration.timestamp}, something is wrong and the sync for this organization will be paused until this is resolved.`,
);
return;
}

const rootHistoryZeroBasedCount = rootHistory.length - 1;
const syncRemaining = rootHistoryZeroBasedCount - lastProcessedIndex;
const isSynced = syncRemaining === 0;
Expand Down

0 comments on commit 0408228

Please sign in to comment.