From: David ‘Bombe’ Roden Date: Fri, 28 Jan 2011 14:11:50 +0000 (+0100) Subject: Don’t run background fetchers for Sones that are last updated more than 7 days ago. X-Git-Tag: 0.4.4^2~13 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0521aa52048c343e9f2ea2920d5f9ac65d724272;p=Sone.git Don’t run background fetchers for Sones that are last updated more than 7 days ago. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 60d334e..5da3bac 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -1743,6 +1743,7 @@ public class Core implements IdentityListener, UpdateListener { public void run() { Sone sone = getRemoteSone(identity.getId()); sone.setIdentity(identity); + soneDownloader.addSone(sone); soneDownloader.fetchSone(sone); } }).start(); diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index 3ccda5b..e22f407 100644 --- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java +++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java @@ -176,7 +176,7 @@ public class FreenetInterface { } }; soneUskCallbacks.put(sone.getId(), uskCallback); - node.clientCore.uskManager.subscribe(USK.create(sone.getRequestUri()), uskCallback, true, (HighLevelSimpleClientImpl) client); + node.clientCore.uskManager.subscribe(USK.create(sone.getRequestUri()), uskCallback, (System.currentTimeMillis() - sone.getTime()) < 7 * 24 * 60 * 60 * 1000, (HighLevelSimpleClientImpl) client); } catch (MalformedURLException mue1) { logger.log(Level.WARNING, "Could not subscribe USK “" + sone.getRequestUri() + "”!", mue1); } diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java index 2eb4c71..177b462 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloader.java @@ -94,6 +94,7 @@ public class SoneDownloader extends AbstractService { */ public void addSone(Sone sone) { if (sones.add(sone)) { + freenetInterface.unregisterUsk(sone); freenetInterface.registerUsk(sone, this); } }