Skip to content

Commit

Permalink
Merge pull request #201 from DataDog/vickenty/drain-loop
Browse files Browse the repository at this point in the history
Avoid busy loop on client shutdown
  • Loading branch information
vickenty authored Sep 2, 2022
2 parents ad4daea + 50ceb1b commit e4fc80f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/timgroup/statsd/StatsDProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ protected void processLoop() {
closeSignal.countDown();
clientClosed = true;
}
if (clientClosed) {
// We are draining highPrioMessages, which is a non-blocking
// queue. Avoid a busy loop if the queue is empty while the aggregator
// is flushing.
Thread.sleep(WAIT_SLEEP_MS);
}
continue;
}

Expand Down

0 comments on commit e4fc80f

Please sign in to comment.