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 pgwilliams committed Apr 16, 2024
1 parent 400ef3c commit 1d1f172
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 1d1f172

Please sign in to comment.