Skip to content

Commit

Permalink
Merge pull request #687 from catenax-ng/feature/#253-fix-bug
Browse files Browse the repository at this point in the history
feat(impl):[#253] fix cancelation bug, when job has no id before save
  • Loading branch information
ds-ext-kmassalski authored Dec 8, 2023
2 parents f84095b + 2c751f1 commit 3a69591
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package org.eclipse.tractusx.irs.services.timeouts;

import java.util.List;
import java.util.Objects;
import java.util.UUID;

import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -62,7 +63,12 @@ public void cancelNotFinishedJobsInBatch(final UUID batchId) {
log.info("Start scheduled timeout process for batchId: {}", batchId.toString());
batchStore.find(batchId).ifPresent(batch -> {
if (isBatchNotCompleted(batch.getBatchState())) {
cancelNotFinishedJobs(batch.getJobProgressList().stream().map(JobProgress::getJobId).toList());
final List<UUID> jobIds = batch.getJobProgressList()
.stream()
.map(JobProgress::getJobId)
.filter(Objects::nonNull)
.toList();
cancelNotFinishedJobs(jobIds);
}
});
}
Expand All @@ -75,7 +81,12 @@ public void cancelNotFinishedJobsInBatchOrder(final UUID batchOrderId) {
.toList();
batches.forEach(batch -> {
if (isBatchNotCompleted(batch.getBatchState())) {
cancelNotFinishedJobs(batch.getJobProgressList().stream().map(JobProgress::getJobId).toList());
final List<UUID> jobIds = batch.getJobProgressList()
.stream()
.map(JobProgress::getJobId)
.filter(Objects::nonNull)
.toList();
cancelNotFinishedJobs(jobIds);
}
});
}
Expand Down

0 comments on commit 3a69591

Please sign in to comment.