Skip to content

Commit

Permalink
MAINT-2529 Startup RS type checks fail gracefully.
Browse files Browse the repository at this point in the history
Refset type checks fail gracefully if the MAIN branch is locked during startup.
  • Loading branch information
kaicode authored and dmcgihtsdo committed Apr 22, 2024
1 parent a749dd3 commit 81bcea3
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -609,12 +609,16 @@ private void setupTypes(Set<ReferenceSetType> referenceSetTypes) {
if (!branchService.exists(MAIN)) {
sBranchService.create(MAIN);
}
if (branchService.findLatest(path).isLocked()) {
logger.warn("{} branch is locked. Unable to verify reference set type configuration.", path);
return;
}
logger.info("Reference set types are configured against branch: '{}'.", path);
List<ReferenceSetType> existingTypes = findConfiguredReferenceSetTypes(path);
Set<ReferenceSetType> typesToRemove = new HashSet<>(existingTypes);
typesToRemove.removeAll(referenceSetTypes);
if (!typesToRemove.isEmpty()) {
String message = String.format("Removing reference set types: %s", typesToRemove.toString());
String message = String.format("Removing reference set types: %s", typesToRemove);
logger.info(message);
try (Commit commit = branchService.openCommit(path, branchMetadataHelper.getBranchLockMetadata(message))) {
typesToRemove.forEach(ReferenceSetType::markDeleted);
Expand Down

0 comments on commit 81bcea3

Please sign in to comment.