Skip to content

Commit

Permalink
fix concurrency
Browse files Browse the repository at this point in the history
  • Loading branch information
piergm committed Nov 14, 2024
1 parent 4e89c76 commit d87d2c0
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public final void run() {
}
}
for (PendingExecutions pendingExecutions : pendingExecutionsPerNode.values()) {
if (pendingExecutions.released.compareAndSet(false, true) == false) {
if (pendingExecutions.released.compareAndSet(false, true)) {
pendingExecutions.semaphore.release(maxConcurrentRequestsPerNode);
pendingExecutions.flushQueue();
}
Expand Down Expand Up @@ -820,7 +820,7 @@ void submit(Consumer<Releasable> task) {
executeAndRelease(task);
} else {
queue.add(task);
if (queuedItems.incrementAndGet() >= permits && released.compareAndSet(false, true) == false) {
if (queuedItems.incrementAndGet() >= permits && released.compareAndSet(false, true)) {
semaphore.release(permits);
}
flushQueue();
Expand Down

0 comments on commit d87d2c0

Please sign in to comment.