Skip to content

Commit

Permalink
Don't log the cancellation exception. (#52)
Browse files Browse the repository at this point in the history
Get a consistent implementation with respect to other calculation services.
  • Loading branch information
antoinebhs authored Dec 5, 2023
1 parent 80cb3f2 commit 2cb0e40
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import java.util.function.Consumer;
import java.util.function.Function;

import static org.gridsuite.sensitivityanalysis.server.service.NotificationService.CANCEL_MESSAGE;
import static org.gridsuite.sensitivityanalysis.server.service.NotificationService.FAIL_MESSAGE;

/**
Expand Down Expand Up @@ -211,6 +212,7 @@ private void cancelSensitivityAnalysisAsync(SensitivityAnalysisCancelContext can
private void cleanSensitivityAnalysisResultsAndPublishCancel(UUID resultUuid, String receiver) {
resultRepository.delete(resultUuid);
notificationService.publishStop(resultUuid, receiver);
LOGGER.info(CANCEL_MESSAGE + " (resultUuid='{}')", resultUuid);
}

@Bean
Expand Down Expand Up @@ -241,8 +243,8 @@ public Consumer<Message<String>> consumeRun() {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception | OutOfMemoryError e) {
LOGGER.error(FAIL_MESSAGE, e);
if (!(e instanceof CancellationException)) {
LOGGER.error(FAIL_MESSAGE, e);
notificationService.publishFail(resultContext.getResultUuid(), resultContext.getRunContext().getReceiver(), e.getMessage());
resultRepository.delete(resultContext.getResultUuid());
resultRepository.insertStatus(List.of(resultContext.getResultUuid()), SensitivityAnalysisStatus.FAILED.name());
Expand Down

0 comments on commit 2cb0e40

Please sign in to comment.