Skip to content

Commit

Permalink
Don't wait indefinitely for active op count to drain
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarge committed Oct 2, 2024
1 parent fa9c2bd commit a55dab2
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,16 @@ protected final void doShutdown() {
@Override
protected final void doStop() throws IllegalStateException {
if (waitOpFinishBeforeStop) {
while ((activeOpCount() != 0) && !Thread.currentThread().isInterrupted()) {
var i = 0;
var sleep = 1000;
for (; ((activeOpCount() != 0) && !Thread.currentThread().isInterrupted()) && i < 10; i++) {
try {
Thread.sleep(1000);
Thread.sleep(sleep);
} catch (InterruptedException e) {
Loggers.MSG.debug("couldn't put context thread {} to sleep or was interrupted", this);
}
}
Loggers.MSG.info("{}: waited {}ms for ops to finish (active count = {})", id, i * sleep, activeOpCount());
}

driver.stop();
Expand Down

0 comments on commit a55dab2

Please sign in to comment.