avikganguly01 commented on a change in pull request #464: FINERACT-428 
Parallelization of Jobs :Parallelizing and paging of update loan summary
URL: https://github.com/apache/fineract/pull/464#discussion_r254056638
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/scheduledjobs/service/ScheduledJobRunnerServiceImpl.java
 ##########
 @@ -443,43 +466,109 @@ public void updateTrialBalanceDetails() throws 
JobExecutionException {
                     .append("from acc_gl_journal_entry je WHERE 
je.transaction_date = ? ")
                     .append("group by je.account_id, je.office_id, 
je.transaction_date, Date(je.entry_date)");
 
-            final int result = jdbcTemplate.update(sqlBuilder.toString(), new 
Object[] {
+            final int result = jdbcTemplate.update(sqlBuilder.toString(), new 
Object[]{
                     formattedDate
             });
             logger.info(ThreadLocalContextUtil.getTenant().getName() + ": 
Results affected by update: " + result);
         }
 
+
         // Updating closing balance
-        String distinctOfficeQuery = "select distinct(office_id) from 
m_trial_balance where closing_balance is null group by office_id";
-        final List<Long> officeIds = 
jdbcTemplate.queryForList(distinctOfficeQuery, new Object[] {}, Long.class);
+        String distinctOfficeQuery = "SELECT DISTINCT(office_id) FROM 
m_trial_balance WHERE closing_balance IS NULL GROUP BY office_id";
+        final List<Long> officeIds = 
jdbcTemplate.queryForList(distinctOfficeQuery, new Object[]{}, Long.class);
 
 
-        for(Long officeId : officeIds) {
-            String distinctAccountQuery = "select distinct(account_id) from 
m_trial_balance where office_id=? and closing_balance is null group by 
account_id";
-            final List<Long> accountIds = 
jdbcTemplate.queryForList(distinctAccountQuery, new Object[] {officeId}, 
Long.class);
-            for(Long accountId : accountIds) {
-                final String closingBalanceQuery = "select closing_balance 
from m_trial_balance where office_id=? and account_id=? and closing_balance " +
-                        "is not null order by created_date desc, entry_date 
desc limit 1";
-                List<BigDecimal> closingBalanceData = 
jdbcTemplate.queryForList(closingBalanceQuery, new Object[] {officeId, 
accountId}, BigDecimal.class);
+        for (Long officeId : officeIds) {
+            String distinctAccountQuery = "SELECT DISTINCT(account_id) FROM 
m_trial_balance WHERE office_id=? AND closing_balance IS NULL GROUP BY 
account_id";
+            final List<Long> accountIds = 
jdbcTemplate.queryForList(distinctAccountQuery, new Object[]{officeId}, 
Long.class);
+            for (Long accountId : accountIds) {
+                final String closingBalanceQuery = "SELECT closing_balance 
FROM m_trial_balance WHERE office_id=? AND account_id=? AND closing_balance " +
+                        "IS NOT NULL ORDER BY created_date DESC, entry_date 
DESC LIMIT 1";
+                List<BigDecimal> closingBalanceData = 
jdbcTemplate.queryForList(closingBalanceQuery, new Object[]{officeId, 
accountId}, BigDecimal.class);
 
 Review comment:
   Hey K2, can you include the JMeter script you used to load test this in the 
PR as well? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to