Fix RestartWorker not starting when ping is missing
This commit is contained in:
parent
6ee69319fd
commit
3c89647889
|
@ -35,7 +35,14 @@ class RestartWorker(ctx: Context, params: WorkerParameters) : Worker(ctx, params
|
|||
Log.d(TAG, "restartDate: ${restartDate.time}")
|
||||
if (currentDate.after(restartDate)) {
|
||||
Log.d(TAG, "We should have received an event before ${restartDate.time}. Restarting")
|
||||
/** We do not update [FailureHandler]'s counter, it will be done by the next requests. */
|
||||
/**
|
||||
* If there is at least one failure, we do not update [FailureHandler]'s counter,
|
||||
* it will be done by the next requests.
|
||||
* Else we add one failure to be sure the service restarts.
|
||||
*/
|
||||
if (!FailureHandler.hasFailed()) {
|
||||
FailureHandler.once()
|
||||
}
|
||||
StartService.startListener(applicationContext)
|
||||
// We consider this run as the first event
|
||||
AppCompanion.lastEventDate = currentDate
|
||||
|
|
Loading…
Reference in New Issue