Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<UUID> lastLogId = new AtomicReference<UUID>();
final AtomicReference<UUID> lastLogId = new AtomicReference<>();
final ScheduledFuture<?> future = scheduledExecutorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
Expand All @@ -71,7 +74,7 @@ public void run() {
}
}
}
}, 0, 1, TimeUnit.SECONDS);
}, INITIAL_DELAY_MS, PERIOD_MS, TimeUnit.MILLISECONDS);

sse.onClose(new Throwing.Runnable() {
@Override
Expand Down