X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FFreenetInterface.java;h=545bda21734fc82eae71024468160b04759ffe78;hb=b7c6d579e0f873c0a648d865d0c838b221563080;hp=a5cd8b46c0dfecdaa34bb2aeaef932a2b1b3b558;hpb=9411a2829261e28c88709228b07e1784e7333bd6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index a5cd8b4..545bda2 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. * @@ -347,7 +351,7 @@ public class FreenetInterface { * * @author David ‘Bombe’ Roden */ - public static interface Callback { + public interface Callback { /** * Notifies a listener that a new edition was found for a URI.