From 4e45108fa8d1625d8879d92de963582b6a1b17ec Mon Sep 17 00:00:00 2001 From: sim Date: Mon, 28 Feb 2022 22:59:51 +0100 Subject: [PATCH] Fix restarting worker --- .../distributor/nextpush/services/RestartWorker.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartWorker.kt b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartWorker.kt index fc7201d..e69fa93 100644 --- a/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartWorker.kt +++ b/app/src/main/java/org/unifiedpush/distributor/nextpush/services/RestartWorker.kt @@ -31,8 +31,10 @@ class RestartWorker (ctx: Context, params: WorkerParameters) : Worker(ctx, param override fun doWork(): Result { Log.d(TAG, "Working") val currentDate = Calendar.getInstance() - val restartDate = lastEventDate?.add(Calendar.MINUTE, 15) + val restartDate = lastEventDate + restartDate?.add(Calendar.MINUTE, 15) if (restartDate == null || currentDate.after(restartDate)) { + Log.d(TAG, "Restarting") StartService.startListener(applicationContext) } return Result.success()