added comment regarding potential race condition
This commit is contained in:
parent
73969f5a40
commit
3e66a21805
@ -18,6 +18,8 @@ public class MembershipValidator {
|
||||
throw new BadRequestAlertException("Invalid untilDate", Membership.ENTITY_NAME, "untilDateMustBeAfterSinceDate");
|
||||
}
|
||||
|
||||
// It's known that this validation can cause a race condition if two memberships of the same customer are saved at
|
||||
// same time (overlapping transactions). This is ignored in this case because it's too unlikely to be worth the effort.
|
||||
if (membershipRepository.hasUncancelledMembershipForCustomer(membershipDTO.getCustomerId())) {
|
||||
throw new BadRequestAlertException("Another uncancelled membership exists", Membership.ENTITY_NAME, "anotherUncancelledMembershipExists");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user