Skip to content

Commit

Permalink
schedule with fixed delay
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Nov 3, 2023
1 parent 27e13aa commit 9fd8282
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/vc/live/LiveFeed.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public LiveFeed(final RedisClient redisClient,
this.executorService = executorService;
this.objectMapper = objectMapper;
syncChannels();
this.executorService.scheduleAtFixedRate(this::processMessageQueue, ((int) (Math.random() * 10)), 10, SECONDS);
this.executorService.scheduleWithFixedDelay(this::processMessageQueue, ((int) (Math.random() * 10)), 10, SECONDS);
inputQueues().forEach(this::monitorQueue);
}

Expand All @@ -73,7 +73,7 @@ record InputQueue<T>(String queueName, Class<T> deserializedType, Function<T, Em
private void monitorQueue(final InputQueue inputQueue) {
final RBoundedBlockingQueue<String> queue = this.redisClient.getQueue(inputQueue.queueName());
inputQueues.put(inputQueue, queue);
this.executorService.scheduleAtFixedRate(() -> processInputQueue(queue, inputQueue), 1, 3, SECONDS);
this.executorService.scheduleWithFixedDelay(() -> processInputQueue(queue, inputQueue), 1, 3, SECONDS);
}

private String feedName() {
Expand Down

0 comments on commit 9fd8282

Please sign in to comment.