Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
fix: use better diff time to check sync status
Browse files Browse the repository at this point in the history
closes #858
  • Loading branch information
fengmk2 committed Apr 5, 2016
1 parent 0329cfa commit faa840d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,11 @@ function* checkSyncStatus() {
}
var diff = Date.now() - lastSyncTime;
var oneDay = 3600000 * 24;
if (diff > oneDay) {
var err = new Error('Last sync time is expired in ' + diff + ' ms, lastSyncTime: ' + new Date(lastSyncTime));
err.name = 'SyncExpriedError';
var maxTime = Math.max(oneDay, syncInterval);
if (diff > maxTime) {
var err = new Error('Last sync time is expired in ' + diff + ' ms, lastSyncTime: ' +
new Date(lastSyncTime) + ', maxTime: ' + maxTime + ' ms');
err.name = 'SyncExpiredError';
sendMailToAdmin(err, null, new Date());
}
}

0 comments on commit faa840d

Please sign in to comment.