From c37b5e0044a3d48d6bc2c3bb71a0b38a9302d455 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 5 Mar 2014 21:29:33 +0100 Subject: [PATCH] Add helper method to clear up intent. --- src/main/java/net/pterodactylus/sone/core/FreenetInterface.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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. * -- 2.7.4