Skip to content

Commit

Permalink
Avoid running multiple polling threads per device (#693)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson authored Nov 12, 2021
1 parent 0af9347 commit f87b1c6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ public void run() {
// Polling starts almost immediately to get an immediate refresh
// Add some random element to the period so that all things aren't synchronised
int pollingPeriodMs = pollingPeriod * 1000 + new Random().nextInt(pollingPeriod * 100);
pollingJob = scheduler.scheduleAtFixedRate(pollingRunnable, new Random().nextInt(pollingPeriodMs),
pollingJob = scheduler.scheduleWithFixedDelay(pollingRunnable, new Random().nextInt(pollingPeriodMs),
pollingPeriodMs, TimeUnit.MILLISECONDS);
logger.debug("{}: Polling initialised at {}ms", nodeIeeeAddress, pollingPeriodMs);
}
Expand Down

0 comments on commit f87b1c6

Please sign in to comment.