Skip to content

Commit

Permalink
fix: missed wakeup calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ishland committed Aug 3, 2024
1 parent 34c4328 commit 37739c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public abstract class DaemonizedStatusAdvancingScheduler<K, V, Ctx, UserData> ex
private final Object notifyMonitor = new Object();
private final Queue<Runnable> taskQueue = createTaskQueue();
private final Executor executor = e -> {
final boolean hasPendingUpdates = this.hasPendingUpdates();
final boolean needWakeup = this.taskQueue.isEmpty();
taskQueue.add(e);
if (!hasPendingUpdates) wakeUp();
if (needWakeup) wakeUp();
};
private final Scheduler scheduler = Schedulers.from(this.executor);
private final AtomicBoolean shutdown = new AtomicBoolean(false);
Expand Down Expand Up @@ -113,9 +113,7 @@ protected boolean hasPendingUpdates() {

@Override
protected void markDirty(K key) {
final boolean hasPendingUpdates = this.hasPendingUpdates();
super.markDirty(key);
if (!hasPendingUpdates) wakeUp();
}

protected void wakeUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ public int itemCount() {
}

protected void markDirty(K key) {
boolean needWakeup = this.pendingUpdates.isEmpty();
this.pendingUpdates.add(key);
if (needWakeup) wakeUp();
}

protected void wakeUp() {
Expand Down

0 comments on commit 37739c0

Please sign in to comment.