X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FFreenetInterface.java;h=48c1c6bf717e98880dbe0c840ef3438f8503e961;hp=a5cd8b46c0dfecdaa34bb2aeaef932a2b1b3b558;hb=c37b5e0044a3d48d6bc2c3bb71a0b38a9302d455;hpb=9411a2829261e28c88709228b07e1784e7333bd6 diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index a5cd8b4..48c1c6b 100644 --- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java +++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java @@ -228,13 +228,17 @@ public class FreenetInterface { logger.log(FINE, format("Registering Sone “%s” for USK updates at %s…", sone, TO_FREENET_URI.apply(sone).setMetaString(new String[]{"sone.xml"}))); USKCallback uskCallback = new NewEditionFound(sone, soneDownloader); soneUskCallbacks.put(sone.getId(), uskCallback); - boolean runBackgroundFetch = (System.currentTimeMillis() - sone.getTime()) < DAYS.toMillis(7); + boolean runBackgroundFetch = soneWasUpdatedInTheLastWeek(sone); uskManager.subscribe(USK.create(TO_FREENET_URI.apply(sone)), uskCallback, runBackgroundFetch, requestClient); } catch (MalformedURLException mue1) { logger.log(WARNING, format("Could not subscribe USK “%s”!", TO_FREENET_URI.apply(sone)), mue1); } } + private boolean soneWasUpdatedInTheLastWeek(Sone sone) { + return (System.currentTimeMillis() - sone.getTime()) < DAYS.toMillis(7); + } + /** * Unsubscribes the request URI of the given Sone. *