Set last sync time to start of sync when doing a long running sync.

Signed-off-by: Mark Beamer Jr <markbeamerjr@gmail.com>
This commit is contained in:
Mark Beamer Jr 2019-09-21 18:09:11 -04:00
parent 162107239b
commit 42bec75ef9
No known key found for this signature in database
GPG key ID: 1C314FB89AD76973

View file

@ -48,6 +48,9 @@ export async function claimSync () {
if (!syncState.LastID) {
syncState.LastID = 0;
}
if (!syncState.StartSyncTime || syncState.LastID === 0) {
syncState.StartSyncTime = new Date().toISOString().slice(0, 19).replace('T', ' ');
}
status.info = 'gettingClaimsToUpdate';
let finished = false;
let lastID = syncState.LastID;
@ -85,7 +88,8 @@ export async function claimSync () {
if (iteration * BatchSize + BatchSize >= MaxClaimsToProcessPerIteration) {
syncState.LastID = lastID;
} else {
syncState.LastSyncTime = new Date().toISOString().slice(0, 19).replace('T', ' ');
syncState.LastID = 0;
syncState.LastSyncTime = syncState.StartSyncTime;
}
await saveJSON(path.join(appRoot.path, 'syncState.json'), syncState);
status.info = 'upToDate';