NetDB: Randomize explore and refresh job delays

This commit is contained in:
zzz
2019-12-20 16:07:24 +00:00
parent 61ec10ff47
commit 5772b7d9ae
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@ class RefreshRoutersJob extends JobImpl {
/** rerun fairly often. 1000 routers in 50 minutes /** rerun fairly often. 1000 routers in 50 minutes
* Don't go faster as this overloads the expl. OBEP / IBGW * Don't go faster as this overloads the expl. OBEP / IBGW
*/ */
private final static long RERUN_DELAY_MS = 3*1000; private final static long RERUN_DELAY_MS = 2500;
private final static long EXPIRE = 2*60*60*1000; private final static long EXPIRE = 2*60*60*1000;
private final static long NEW_LOOP_DELAY = 37*60*1000; private final static long NEW_LOOP_DELAY = 37*60*1000;
private static final int ENOUGH_FFS = 3 * StartExplorersJob.LOW_FFS; private static final int ENOUGH_FFS = 3 * StartExplorersJob.LOW_FFS;
@ -104,6 +104,6 @@ class RefreshRoutersJob extends JobImpl {
} }
} }
} }
requeue(RERUN_DELAY_MS); requeue(RERUN_DELAY_MS + getContext().random().nextInt(1024));
} }
} }

View File

@ -99,7 +99,7 @@ class StartExplorersJob extends JobImpl {
j.getTiming().setStartAfter(getContext().clock().now() + delay); j.getTiming().setStartAfter(getContext().clock().now() + delay);
getContext().jobQueue().addJob(j); getContext().jobQueue().addJob(j);
// spread them out // spread them out
delay += 1250; delay += 1000 + getContext().random().nextInt(512);
} }
} }
long delay = getNextRunDelay(); long delay = getNextRunDelay();