Skip to content

Commit

Permalink
feat(impl):[#253] fix cancelation bug, when job has no id after save
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-ext-kmassalski committed Dec 7, 2023
1 parent f84095b commit 2c751f1
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 2c751f1

Please sign in to comment.