mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
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 eddd91454f
)
Co-authored-by: Andrea Selva <selva.andre@gmail.com>
This commit is contained in:
parent
dae1585325
commit
4292ef9179
1 changed files with 4 additions and 1 deletions
|
@ -254,7 +254,10 @@ public final class DeadLetterQueueWriter implements Closeable {
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue