Skip to content

Commit

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

import static org.gridsuite.loadflow.server.service.LoadFlowRunContext.buildParameters;
import static org.gridsuite.loadflow.server.service.NotificationService.CANCEL_MESSAGE;
import static org.gridsuite.loadflow.server.service.NotificationService.FAIL_MESSAGE;

/**
Expand Down Expand Up @@ -143,6 +144,7 @@ public LoadFlowResult run(Network network, LoadFlowRunContext context, UUID resu
private void cleanLoadFlowResultsAndPublishCancel(UUID resultUuid, String receiver) {
resultRepository.delete(resultUuid);
notificationService.publishStop(resultUuid, receiver);
LOGGER.info(CANCEL_MESSAGE + " (resultUuid='{}')", resultUuid);
}

private static LoadingLimits.TemporaryLimit getBranchLimitViolationAboveCurrentValue(Branch<?> branch, LimitViolationInfos violationInfo) {
Expand Down Expand Up @@ -270,8 +272,8 @@ public Consumer<Message<String>> consumeRun() {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception e) {
LOGGER.error(FAIL_MESSAGE, e);
if (!(e instanceof CancellationException)) {
LOGGER.error(FAIL_MESSAGE, e);
notificationService.publishFail(resultContext.getResultUuid(), resultContext.getRunContext().getReceiver(), e.getMessage(), resultContext.getRunContext().getUserId());
resultRepository.delete(resultContext.getResultUuid());
}
Expand Down

0 comments on commit e666d07

Please sign in to comment.