You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "ruchiD (via GitHub)" <gi...@apache.org> on 2023/03/28 11:41:57 UTC

[GitHub] [fineract] ruchiD commented on a diff in pull request #3080: FINERACT-1724: Optimizing the account locking for Loan COB

ruchiD commented on code in PR #3080:
URL: https://github.com/apache/fineract/pull/3080#discussion_r1150462174


##########
fineract-provider/src/main/java/org/apache/fineract/cob/loan/FetchAndLockLoanTasklet.java:
##########
@@ -87,10 +92,21 @@ public RepeatStatus execute(@NotNull StepContribution contribution, @NotNull Chu
         return RepeatStatus.FINISHED;
     }
 
-    private void applySoftLock(List<Long> alreadySoftLockedAccounts) {
-        for (Long loanId : alreadySoftLockedAccounts) {
-            LoanAccountLock loanAccountLock = new LoanAccountLock(loanId, LockOwner.LOAN_COB_PARTITIONING);
-            loanAccountLockRepository.save(loanAccountLock);
-        }
+    private void applySoftLock(List<Long> accountsToLock) {
+        LocalDate cobBusinessDate = ThreadLocalContextUtil.getBusinessDateByType(BusinessDateType.COB_DATE);
+        jdbcTemplate.batchUpdate("""
+                    INSERT INTO m_loan_account_locks (loan_id, version, lock_owner, lock_placed_on, lock_placed_on_cob_business_date)
+                    VALUES (?, ?, ?, ?, ?)
+                """, accountsToLock, getInClauseParameterSizeLimit(), (ps, id) -> {

Review Comment:
   Hi Arnold, Did we compared execution time with @Modifying + @Query on repository method also for this optimization.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org