Add time unit parameter

This commit is contained in:
Rexbas
2023-05-12 21:52:30 +02:00
parent 1253b7db2b
commit 32d7189a12
2 changed files with 4 additions and 3 deletions

View File

@@ -33,7 +33,7 @@ public class AutoUnlocker {
this.scheduler = scheduler;
}
public void tryUnlockForTimespan(int timespan) {
public void tryUnlockForTimespan(int timespan, TimeUnit timeUnit) {
// Unlock all available auto unlock vaults
unlock(vaults.stream().filter(v -> v.getVaultSettings().unlockAfterStartup().get()));
@@ -41,7 +41,7 @@ public class AutoUnlocker {
if (getMissingAutoUnlockVaults().findAny().isPresent()) {
LOG.info("Found MISSING vaults, starting periodic check");
unlockMissingFuture = scheduler.scheduleWithFixedDelay(this::unlockMissing, 0, 1, TimeUnit.SECONDS);
timeoutFuture = scheduler.schedule(this::timeout, timespan, TimeUnit.MINUTES);
timeoutFuture = scheduler.schedule(this::timeout, timespan, timeUnit);
}
}

View File

@@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javax.inject.Named;
import javafx.application.Platform;
import java.util.concurrent.TimeUnit;
@FxApplicationScoped
public class FxApplication {
@@ -68,6 +69,6 @@ public class FxApplication {
});
launchEventHandler.startHandlingLaunchEvents();
autoUnlocker.tryUnlockForTimespan(2);
autoUnlocker.tryUnlockForTimespan(2, TimeUnit.MINUTES);
}
}