From c0b0b5e4c5e449450c73ff7a50fb3e43a598124d Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Thu, 3 Jun 2010 16:51:37 +0000 Subject: [PATCH] Add min delay after startup before fetching news --- .../java/src/net/i2p/router/web/NewsFetcher.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java b/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java index a239f29493..df576254c9 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NewsFetcher.java @@ -92,8 +92,11 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener { return buf.toString(); } + private static final long INITIAL_DELAY = 5*60*1000; + private static final long RUN_DELAY = 10*60*1000; + public void run() { - try { Thread.sleep(_context.random().nextLong(5*60*1000)); } catch (InterruptedException ie) {} + try { Thread.sleep(INITIAL_DELAY + _context.random().nextLong(INITIAL_DELAY)); } catch (InterruptedException ie) {} while (true) { if (!_updateAvailable) checkForUpdates(); if (shouldFetchNews()) { @@ -101,7 +104,7 @@ public class NewsFetcher implements Runnable, EepGet.StatusListener { if (shouldFetchUnsigned()) fetchUnsignedHead(); } - try { Thread.sleep(10*60*1000); } catch (InterruptedException ie) {} + try { Thread.sleep(RUN_DELAY); } catch (InterruptedException ie) {} } } -- GitLab