Don't register the currently running task again inside the task

Affects issues:
- Fixed #1715
This commit is contained in:
Risto Lahtela 2021-01-22 21:44:14 +02:00
parent 97096948dc
commit 94abd68086

View File

@ -128,6 +128,7 @@ public class DBCleanTask extends TaskSystem.Task {
@Override @Override
public void register(RunnableFactory runnableFactory) { public void register(RunnableFactory runnableFactory) {
AbsRunnable taskToRegister = this;
// Secondary task for registration due to database queries. // Secondary task for registration due to database queries.
runnableFactory.create(null, new AbsRunnable() { runnableFactory.create(null, new AbsRunnable() {
@Override @Override
@ -145,7 +146,7 @@ public class DBCleanTask extends TaskSystem.Task {
long delay = TimeAmount.toTicks(startAfter, TimeUnit.MILLISECONDS); long delay = TimeAmount.toTicks(startAfter, TimeUnit.MILLISECONDS);
long period = TimeAmount.toTicks(config.get(TimeSettings.CLEAN_DATABASE_PERIOD), TimeUnit.MILLISECONDS); long period = TimeAmount.toTicks(config.get(TimeSettings.CLEAN_DATABASE_PERIOD), TimeUnit.MILLISECONDS);
runnableFactory.create(null, this).runTaskTimerAsynchronously(delay, period); runnableFactory.create(null, taskToRegister).runTaskTimerAsynchronously(delay, period);
} }
}).runTaskAsynchronously(); }).runTaskAsynchronously();
} }