adamsaghy commented on code in PR #5671:
URL: https://github.com/apache/fineract/pull/5671#discussion_r3050872508
##########
fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsSchedularInterestPoster.java:
##########
@@ -213,8 +213,24 @@ private void batchUpdate(final List<SavingsAccountData>
savingsAccountDataList)
savingsAccountData.setUpdatedTransactions(savingsAccountTransactionDataList);
}
- if (transRefNo.size() > 0) {
- this.jdbcTemplate.batchUpdate(queryForSavingsUpdate,
paramsForSavingsSummary);
+ if (!transRefNo.isEmpty()) {
+ int[] updateCounts =
this.jdbcTemplate.batchUpdate(queryForSavingsUpdate, paramsForSavingsSummary);
+
+ Set<Long> skippedAccountIds = new HashSet<>();
+ for (int i = 0; i < updateCounts.length; i++) {
+ if (updateCounts[i] == 0) {
+ Long accountId = savingsAccountDataList.get(i).getId();
+ skippedAccountIds.add(accountId);
+ log.warn("Optimistic lock failure for savings account
id={} — concurrent modification detected."
+ + " Rolling back. Will retry on next run.",
accountId);
+ }
+ }
+
+ if (!skippedAccountIds.isEmpty()) {
Review Comment:
I dont think it is a bad thing to allow to be updated Account A if Account B
fails... the accounts are independent from each others..
The only issue we should avoid to post twice an interest for the same day or
post an interest but having out of sync account balance...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]