awaneetdecoder commented on code in PR #5671:
URL: https://github.com/apache/fineract/pull/5671#discussion_r3053228060


##########
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:
   @adamsaghy I have pushed the updates in the latest commit:
   
   1. Removed the unused isOverdraft variable.
   2. Changed the batch logic to skip only the failed account's transactions 
rather than rolling back the entire batch.
   
   Could you please approve the CI workflows to run when you have a moment?



-- 
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]

Reply via email to