Reducing calls to Ref Data within the start up of Resume#2027
Reducing calls to Ref Data within the start up of Resume#2027tvr-hmcts wants to merge 5 commits into
Conversation
…he ResumePossessionClaim event.
…rformance issues in the start method. This found only the single database connection for the retrieval of the draft.
CCD diff summary👉 Full report: https://github.com/hmcts/pcs-api/actions/runs/29080717697?check_suite_focus=true No change |
Plan Result (aat)
|
| } | ||
|
|
||
| private PCSCase start(EventPayload<PCSCase, State> eventPayload) { | ||
| PCSCase start(EventPayload<PCSCase, State> eventPayload) { |
There was a problem hiding this comment.
Why was this changed from private to package-private? The tests call the registered CCD handler, not this method directly.
There was a problem hiding this comment.
Ah I placed an integration test against it at that point. I can switch it back as Im not pushing the integration test as I only used it within the profiling.
There was a problem hiding this comment.
Sure, if you could switch back, would be great!
| caseData.setClaimantType(claimantTypeList); | ||
|
|
||
| contactPreferences.setOrganisationAddress(organisationService.getOrganisationAddressForCurrentUser()); | ||
| contactPreferences.setOrganisationAddress(null != nameAndAddress ? nameAndAddress.address() : null); |
There was a problem hiding this comment.
Can we extract using AddressUK orgAddress = nameAndAddress != null ? nameAndAddress.address() : null; to avoid the second null check and make the flow clearer?
There was a problem hiding this comment.
Based on the pattern in the OrganisationDetailsService it is possible for it to fail and then continue - returning null on exception. Ive not changed that pattern, though perhaps that needs revisiting, so it is possible for the response (NameAndAddress) to be null.
| } | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Minor- can we remove extra lines?
| } | ||
|
|
||
| private PCSCase start(EventPayload<PCSCase, State> eventPayload) { | ||
| PCSCase start(EventPayload<PCSCase, State> eventPayload) { |
There was a problem hiding this comment.
Sure, if you could switch back, would be great!
|
|
||
| public NameAndAddress getNameAndAddressForCurrentUser() { | ||
| try { | ||
| UUID userId = resolveUserId(); |
There was a problem hiding this comment.
There's some missing code coverage in a method implemented outside of this PR - getOrganisationAddressForCurrentUser()
There was a problem hiding this comment.
Though the rationale for this ticket is not really in this area per say but in how we use it. I will take bit more of a look though now as a stepping stone. I think this class and the OrganisationDetailsService may need a revisit in general and there is another ticket that may impact it also - though not in flight yet - https://tools.hmcts.net/jira/browse/HDPI-6650
…414-PerfTest-Env-Make-a-Claim-Baseline
…414-PerfTest-Env-Make-a-Claim-Baseline
…414-PerfTest-Env-Make-a-Claim-Baseline
HDPI-5414
Note - this is first run at this ticket. As it has been highlighted further work is needed in other areas also from a performance perspective.
Highlighted in performance testing the start of the ResumePossessionClaim is not meeting SLAs. Identified the double call to Ref Data and have changed the approach there.
I profiled this within an integration test and the results of the change are presented in the Jira.
Ran further hibernate based statistics and only one db call is made for the draft data. We can consider additional work there if needed in the future as splitting this using projections.
Further large or more complex refactoring can/will be considered later also such as caching and parallel calls