Skip to content

This should fix the same race condition in duplicate as 6c2a62469e53d in create #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/main/java/org/gridsuite/study/server/StudyService.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ private CreatedStudyBasicInfos insertStudy(UUID studyUuid, String userId, Networ
return createdStudyBasicInfos;
}

@Transactional
public CreatedStudyBasicInfos insertDuplicatedStudy(BasicStudyInfos studyInfos, StudyEntity sourceStudy, LoadFlowParametersEntity newLoadFlowParameters, String userId, UUID clonedNetworkUuid) {
private CreatedStudyBasicInfos insertDuplicatedStudy(BasicStudyInfos studyInfos, StudyEntity sourceStudy, LoadFlowParametersEntity newLoadFlowParameters, String userId, UUID clonedNetworkUuid) {
Objects.requireNonNull(studyInfos.getId());
Objects.requireNonNull(userId);
Objects.requireNonNull(clonedNetworkUuid);
Expand All @@ -592,7 +591,7 @@ public CreatedStudyBasicInfos insertDuplicatedStudy(BasicStudyInfos studyInfos,

UUID reportUuid = UUID.randomUUID();
StudyEntity studyEntity = new StudyEntity(studyInfos.getId(), userId, LocalDateTime.now(ZoneOffset.UTC), clonedNetworkUuid, sourceStudy.getNetworkId(), sourceStudy.getCaseFormat(), sourceStudy.getCaseUuid(), sourceStudy.isCasePrivate(), sourceStudy.getLoadFlowProvider(), newLoadFlowParameters);
CreatedStudyBasicInfos createdStudyBasicInfos = StudyService.toCreatedStudyBasicInfos(insertDuplicatedStudy(studyEntity, sourceStudy.getId(), reportUuid));
CreatedStudyBasicInfos createdStudyBasicInfos = StudyService.toCreatedStudyBasicInfos(self.insertDuplicatedStudy(studyEntity, sourceStudy.getId(), reportUuid));

studyInfosService.add(createdStudyBasicInfos);
emitStudiesChanged(studyInfos.getId(), userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public NetworkModificationNode toDto(NetworkModificationNodeInfoEntity node) {
int ignoreSize = node.getModificationsToExclude().size(); // to load the lazy collection
return completeNodeInfo(node, new NetworkModificationNode(node.getNetworkModificationId(),
node.getVariantId(),
node.getModificationsToExclude(),
new HashSet<>(node.getModificationsToExclude()),
node.getLoadFlowStatus(),
StudyService.fromEntity(node.getLoadFlowResult()),
node.getSecurityAnalysisResultUuid(),
Expand Down