Update lastEventDate only when we start the service

This commit is contained in:
sim 2024-11-02 12:45:49 +00:00
parent 11dbfcd6e9
commit 38de5edeaa
1 changed files with 4 additions and 2 deletions

View File

@ -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")
/** We do not update [FailureHandler]'s counter, it will be done by the next requests. */
StartService.startListener(applicationContext)
// We consider this run as the first event
AppCompanion.lastEventDate = currentDate
}
} ?: run {
Log.d(TAG, "Restarting")
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()
}