[ 
https://issues.apache.org/jira/browse/FINERACT-3003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18132343#comment-18132343
 ] 

Adam Saghy commented on FINERACT-3003:
--------------------------------------

PR: https://github.com/apache/fineract/pull/6743

> PL - Retained Earning Job - noop changes
> ----------------------------------------
>
>                 Key: FINERACT-3003
>                 URL: https://issues.apache.org/jira/browse/FINERACT-3003
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Job Scheduler
>    Affects Versions: 1.16.0
>            Reporter: Adam Saghy
>            Assignee: Adam Saghy
>            Priority: Major
>             Fix For: 1.17.0
>
>
> *Issue:*
> The retained earning job runs the trial-balance stretchy-report query 
> regardless of whether anything would be persisted — the writer only decided 
> after the fact whether to discard the fetched data. Making the decision once 
> upfront, before the step even starts, lets the job skip the query entirely on 
> the vast majority of daily runs (every day except right after a new fiscal 
> year end).
> *Fix:*
>  * Move the retained-earning idempotency check (whether entries already exist 
> for the fiscal year end date) out of RetainedEarningJobWriter.beforeStep and 
> into a new RetainedEarningJobExecutionDecider, a Spring Batch 
> JobExecutionDecider that runs before the summary step starts.
>  * RetainedEarningJobListener.beforeJob computes the fiscal year end date 
> once and shares it via the job execution context 
> (RetainedEarningJobConstant.FISCAL_YEAR_END_DATE_CONTEXT_KEY), so it is only 
> computed a single time per job run.
>  * The job flow now branches on the decider's outcome: on a NoOp day (entries 
> already exist) the flow ends immediately and the summary step — reader and 
> writer alike — never runs at all, so the trial balance report query is never 
> issued. On a real day, the flow proceeds into retainedEarningSummaryStep.
>  * RetainedEarningJobReader and RetainedEarningJobWriter no longer perform 
> their own idempotency checks; they just read the fiscal year end date from 
> the shared context and process/persist whatever they're given



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to