Skip to content

Commit

Permalink
Group Credentials: Request six days of data to account for clock skew
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Aug 15, 2022
1 parent 1d0b1d8 commit 7399086
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ts/services/groupCredentialFetcher.ts
Expand Up @@ -198,23 +198,23 @@ export function getDatesForRequest(
data?: CredentialsDataType
): RequestDatesType | undefined {
const today = toDayMillis(Date.now());
const oneWeekOut = today + durations.WEEK;
const sixDaysOut = today + 6 * durations.DAY;

const lastCredential = last(data);
if (!lastCredential || lastCredential.redemptionTime < today) {
return {
startDayInMs: today,
endDayInMs: oneWeekOut,
endDayInMs: sixDaysOut,
};
}

if (lastCredential.redemptionTime >= oneWeekOut) {
if (lastCredential.redemptionTime >= sixDaysOut) {
return undefined;
}

return {
startDayInMs: lastCredential.redemptionTime + durations.DAY,
endDayInMs: oneWeekOut,
endDayInMs: sixDaysOut,
};
}

Expand Down

0 comments on commit 7399086

Please sign in to comment.