-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix cached data in ProcessBillingBatchService (#166)
https://eaflood.atlassian.net/browse/WATER-3906 As part of implementing [Handle errors in ProcessBillingBatchService](#161) we refactored the `ProcessBillingBatchService` to make the code cleaner and easier to read. One of the changes was moving the `generatedInvoices` and `generatedInvoiceLicences` to the module scope rather than just in the method scope. It saved us from having to pass them around the place which removed a bunch of 'cruft'. What we didn't take into account is they would be cached between calls to the service. Now it's at module scope the data from previous runs is being cached and still exists when a new one starts. So, we're getting to the finalise stage and we're trying to persist old data from a previous run! This change resolves the issue. --- For reference, we move the variables into the scope of the `go()` function removing the issue of the data being cached at the global scope. We then take a halfway house approach; we pass the information into our methods but we accept having to mutate the data rather than pass back a modified copy.
- Loading branch information
1 parent
90136f4
commit d97d290
Showing
1 changed file
with
31 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters