X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneInserter.java;h=843e9c4f90ff2c79a9d60dba3ba501cd652696f7;hb=ffb2ea1773cf7e3d1b7fc41ab0e9c3c1eed514e0;hp=1e93aa67229bca4fa4a8741ba8346bb51ee78bd3;hpb=c74a6b50636ab4c13967ac90fa4155eea028b836;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 1e93aa6..843e9c4 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -99,6 +99,7 @@ public class SoneInserter extends AbstractService { private final FreenetInterface freenetInterface; private final SoneModificationDetector soneModificationDetector; + private final long delay; /** The Sone to insert. */ private volatile Sone sone; @@ -116,17 +117,18 @@ public class SoneInserter extends AbstractService { * The Sone to insert */ public SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone) { - this(core, eventBus, freenetInterface, sone, new SoneModificationDetector(core, sone, insertionDelay)); + this(core, eventBus, freenetInterface, sone, new SoneModificationDetector(core, sone, insertionDelay), 1000); } @VisibleForTesting - SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone, SoneModificationDetector soneModificationDetector) { + SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone, SoneModificationDetector soneModificationDetector, long delay) { super("Sone Inserter for “" + sone.getName() + "”", false); this.core = core; this.eventBus = eventBus; this.freenetInterface = freenetInterface; this.sone = sone; this.soneModificationDetector = soneModificationDetector; + this.delay = delay; } // @@ -204,7 +206,7 @@ public class SoneInserter extends AbstractService { while (!shouldStop()) { try { /* check every second. */ - sleep(1000); + sleep(delay); if (soneModificationDetector.isEligibleForInsert()) { InsertInformation insertInformation = new InsertInformation(sone);