Group Credentials: Request six days of data to account for clock skew
This commit is contained in:
parent
1d0b1d806a
commit
7399086939
1 changed files with 4 additions and 4 deletions
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue