Update lastEventDate only when we start the service
This commit is contained in:
parent
11dbfcd6e9
commit
38de5edeaa
|
@ -37,13 +37,15 @@ class RestartWorker(ctx: Context, params: WorkerParameters) : Worker(ctx, params
|
||||||
Log.d(TAG, "We should have received an event before ${restartDate.time}. Restarting")
|
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. */
|
/** We do not update [FailureHandler]'s counter, it will be done by the next requests. */
|
||||||
StartService.startListener(applicationContext)
|
StartService.startListener(applicationContext)
|
||||||
|
// We consider this run as the first event
|
||||||
|
AppCompanion.lastEventDate = currentDate
|
||||||
}
|
}
|
||||||
} ?: run {
|
} ?: run {
|
||||||
Log.d(TAG, "Restarting")
|
Log.d(TAG, "Restarting")
|
||||||
StartService.startListener(applicationContext)
|
StartService.startListener(applicationContext)
|
||||||
|
// We consider this run as the first event
|
||||||
|
AppCompanion.lastEventDate = currentDate
|
||||||
}
|
}
|
||||||
// We consider this run as the first event
|
|
||||||
AppCompanion.lastEventDate = currentDate
|
|
||||||
}
|
}
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue