diff --git a/osgi-bundles/bundles/logger/src/main/java/org/killbill/billing/osgi/bundles/logger/LogsSseHandler.java b/osgi-bundles/bundles/logger/src/main/java/org/killbill/billing/osgi/bundles/logger/LogsSseHandler.java index 812eee2ff..c2e90d36a 100644 --- a/osgi-bundles/bundles/logger/src/main/java/org/killbill/billing/osgi/bundles/logger/LogsSseHandler.java +++ b/osgi-bundles/bundles/logger/src/main/java/org/killbill/billing/osgi/bundles/logger/LogsSseHandler.java @@ -34,6 +34,9 @@ public class LogsSseHandler implements Sse.Handler, Closeable { + private static final long INITIAL_DELAY_MS = 200; + private static final long PERIOD_MS = 1000; + private final LogEntriesManager logEntriesManager; private final ScheduledExecutorService scheduledExecutorService; @@ -54,7 +57,7 @@ public void handle(final Request req, final Sse sse) { final UUID cacheId = UUID.fromString(sse.id()); logEntriesManager.subscribe(cacheId, lastEventId); - final AtomicReference lastLogId = new AtomicReference(); + final AtomicReference lastLogId = new AtomicReference<>(); final ScheduledFuture future = scheduledExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { @@ -71,7 +74,7 @@ public void run() { } } } - }, 0, 1, TimeUnit.SECONDS); + }, INITIAL_DELAY_MS, PERIOD_MS, TimeUnit.MILLISECONDS); sse.onClose(new Throwing.Runnable() { @Override