Skip to content

Commit

Permalink
[WOR-1772] Catch duplicate PAO exception when trying to create a PAO …
Browse files Browse the repository at this point in the history
…that has been deleted (#1772)
  • Loading branch information
marctalbott authored Jul 12, 2024
1 parent a5808cc commit f54e983
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@ public TpsPaoGetResult getOrCreatePao(
return pao.get();
}
// Workspace doesn't have a PAO, so create an empty one for it.
createPao(objectId, null, component, objectType);
try {
createPao(objectId, null, component, objectType);
} catch (PolicyServiceDuplicateException e) {
// If the PAO wasn't returned above, but creating a new one threw a duplicate exception, the
// original PAO has been deleted and we cannot recreate a new one. PAOs are only deleted when
// the associated object (workspace, spend-profile) has been deleted. We return null here to
// handle the race condition where WSM is returning a workspace that is in the process
// of being deleted.
return null;
}
return getPao(objectId);
}

Expand Down

0 comments on commit f54e983

Please sign in to comment.