Ashhar Ahmad Khan created FINERACT-2582:
-------------------------------------------

             Summary: Performance issue: constant repository lookups executed 
inside loops in email campaign and notification services
                 Key: FINERACT-2582
                 URL: https://issues.apache.org/jira/browse/FINERACT-2582
             Project: Apache Fineract
          Issue Type: Bug
            Reporter: Ashhar Ahmad Khan


Two methods perform identical repository lookups inside loops where the 
argument never changes across iterations, causing N redundant DB round-trips 
per invocation.

*Class 1:* UpdateEmailOutboundWithCampaignMessageTasklet
Method: insertDirectCampaignIntoEmailOutboundTable(...)
emailCampaignRepository.findById(campaignId) is called once per loop iteration, 
but campaignId is constant for the entire method.

*Class 2:* NotificationWritePlatformServiceImpl
Method: insertIntoNotificationMapper(...)
notificationGeneratorReadRepositoryWrapper.findById(generatedNotificationId) is 
called once per loop iteration, but generatedNotificationId is constant for the 
entire method.

Fix: hoist both lookups above their respective loops so each executes exactly 
once per method invocation.

Same class of redundancy as FINERACT-2561.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to