Skip to content

Commit

Permalink
fix: interrupt processLogsAndUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeDombo committed Oct 5, 2023
1 parent 29d55ee commit b4cef92
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ private void updatelastComponentUploadedLogFile(Map<String, Instant> lastCompone
*/
@SuppressWarnings("PMD.CollapsibleIfStatements")
private void processLogsAndUpload() throws InterruptedException {
while (true) {
while (!Thread.currentThread().isInterrupted()) {
//TODO: this is only done for passing the current text. But in practise, we don`t need to intentionally
// sleep here.
if (!isCurrentlyUploading.compareAndSet(false, true)) {
Expand All @@ -702,6 +702,9 @@ private void processLogsAndUpload() throws InterruptedException {
try {
LogFileGroup logFileGroup = LogFileGroup.create(componentLogConfiguration,
lastUploadedLogFileTimeMs, workDir);
if (Thread.currentThread().isInterrupted()) {
return;
}

if (logFileGroup.getLogFiles().isEmpty()) {
continue;
Expand Down

0 comments on commit b4cef92

Please sign in to comment.