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

Commit

Permalink
Simplify logic
Browse files Browse the repository at this point in the history
After thinking about the comment from @NejcZdovc, I have concluded that
simpler is better in this recovery case.
  • Loading branch information
mrose17 committed Apr 10, 2018
1 parent d40d867 commit c15f33a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,8 @@ Client.prototype.sync = function (callback) {

if (!self.state.properties) self.state.properties = {}
if ((self.state.reconcileStamp === null) || (isNaN(self.state.reconcileStamp))) {
if (self.state.properties.reconcileDate) self.state.reconcileStamp = new Date(self.state.properties.reconcileDate).getTime()
else if (self.state.properties.days) self.state.reconcileStamp = self.state.properties.days * msecs.day

// WHY: isNaN(null) === false
if ((self.state.reconcileStamp === null) || (isNaN(self.state.reconcileStamp))) self.state.reconcileStamp = 14 * msecs.day
self.state.reconcileStamp = now + (14 * msecs.day)
self._log('sync', { reconcileStamp: self.state.reconcileStamp })
return self.setTimeUntilReconcile(null, callback)
}
Expand Down

0 comments on commit c15f33a

Please sign in to comment.