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
…15656)

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).

(cherry picked from commit eddd914)

Co-authored-by: Andrea Selva <[email protected]>
  • Loading branch information
github-actions[bot] and andsel authored Dec 5, 2023
1 parent dae1585 commit 4292ef9
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 4292ef9

Please sign in to comment.