Skip to content

Commit

Permalink
Shutdown DLQ segments flusher only if it has been started (#15649)
Browse files Browse the repository at this point in the history
In DLQ unit testing sometime the DLQ writer is started explicitly without starting the segments flushers. In such cases the test 's logs contains exceptions which could lead to think that the test fails silently.

Avoid to invoke scheduledFlusher's shutdown when it's not started (such behaviour is present only in tests).
  • Loading branch information
andsel authored Dec 5, 2023
1 parent a26b1d3 commit eddd914
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ public void close() {
}

try {
flushScheduler.shutdown();
// flushScheduler is null only if it's not explicitly started, which happens only in tests.
if (flushScheduler != null) {
flushScheduler.shutdown();
}
} catch (Exception e) {
logger.warn("Unable shutdown flush scheduler, ignoring", e);
}
Expand Down

0 comments on commit eddd914

Please sign in to comment.