Prevent sync worker crash when too few services connected causing early exit
@@ -174,8 +174,7 @@ class Sync:
logger.info("Not scheduling auto sync for paid user")
else:
nextSync = datetime.utcnow() + Sync.SyncInterval + timedelta(seconds=random.randint(-Sync.SyncIntervalJitter.total_seconds(), Sync.SyncIntervalJitter.total_seconds()))
- if result:
- if result.ForceNextSync:
+ if result and result.ForceNextSync:
logger.info("Forcing next sync at %s" % result.ForceNextSync)
nextSync = result.ForceNextSync
reschedule_update = {
@@ -188,7 +187,7 @@ class Sync:
}
}
- if result.ForceExhaustive:
+ if result and result.ForceExhaustive:
logger.info("Forcing next sync as exhaustive")
reschedule_update["$set"]["NextSyncIsExhaustive"] = True
else:
