mirror of
https://github.com/M66B/FairEmail.git
synced 2025-01-01 04:35:57 +00:00
Refactoring
This commit is contained in:
parent
46fec74282
commit
b3db2956d1
3 changed files with 14 additions and 15 deletions
|
@ -127,13 +127,13 @@ public class WorkerCleanup extends Worker {
|
|||
}
|
||||
|
||||
static void queue() {
|
||||
String tag = "cleanup";
|
||||
Log.i("Queuing work " + tag);
|
||||
String tag = WorkerCleanup.class.getSimpleName();
|
||||
Log.i("Queuing " + tag);
|
||||
|
||||
try {
|
||||
for (WorkInfo info : WorkManager.getInstance().getWorkInfosByTag(tag).get())
|
||||
if (!info.getState().isFinished()) {
|
||||
Log.i("Work already queued " + tag);
|
||||
Log.i("Already queued " + tag);
|
||||
return;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
|
@ -151,13 +151,12 @@ public class WorkerCleanup extends Worker {
|
|||
.build();
|
||||
WorkManager.getInstance().enqueue(workRequest);
|
||||
|
||||
Log.i("Queued work " + tag);
|
||||
Log.i("Queued " + tag);
|
||||
}
|
||||
|
||||
static void cancel() {
|
||||
String tag = "cleanup";
|
||||
Log.i("Cancelling work " + tag);
|
||||
|
||||
String tag = WorkerCleanup.class.getSimpleName();
|
||||
Log.i("Cancelling " + tag);
|
||||
WorkManager.getInstance().cancelAllWorkByTag(tag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -85,13 +85,13 @@ public class WorkerFolderSync extends Worker {
|
|||
}
|
||||
|
||||
static void queue(long aid) {
|
||||
String tag = "fsync:" + aid;
|
||||
Log.i("Queuing work " + tag);
|
||||
String tag = WorkerFolderSync.class.getSimpleName() + ":" + aid;
|
||||
Log.i("Queuing " + tag);
|
||||
|
||||
try {
|
||||
for (WorkInfo info : WorkManager.getInstance().getWorkInfosByTag(tag).get())
|
||||
if (!info.getState().isFinished()) {
|
||||
Log.i("Work already queued " + tag);
|
||||
Log.i("Already queued " + tag);
|
||||
return;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
|
@ -106,6 +106,6 @@ public class WorkerFolderSync extends Worker {
|
|||
.build();
|
||||
WorkManager.getInstance().enqueue(workRequest);
|
||||
|
||||
Log.i("Queued work " + tag);
|
||||
Log.i("Queued " + tag);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,13 +119,13 @@ public class WorkerOperations extends Worker {
|
|||
}
|
||||
|
||||
static void queue(long fid) {
|
||||
String tag = "operations:" + fid;
|
||||
Log.i("Queuing work " + tag);
|
||||
String tag = WorkerOperations.class.getSimpleName() + ":" + fid;
|
||||
Log.i("Queuing " + tag);
|
||||
|
||||
try {
|
||||
for (WorkInfo info : WorkManager.getInstance().getWorkInfosByTag(tag).get())
|
||||
if (!info.getState().isFinished()) {
|
||||
Log.i("Work already queued " + tag);
|
||||
Log.i("Already queued " + tag);
|
||||
return;
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
|
@ -140,6 +140,6 @@ public class WorkerOperations extends Worker {
|
|||
.build();
|
||||
WorkManager.getInstance().enqueue(workRequest);
|
||||
|
||||
Log.i("Queued work " + tag);
|
||||
Log.i("Queued " + tag);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue