Skip to content

Commit 5ab5fdc

Browse files
floehopperchrislo
andcommitted
Move post-commit operations -> ImmunisationImport#post_commit!
The name of this method suggests it's purpose is to execute code against the data committed by the transaction in `ImmunisationImport#process!`. It wasn't obvious to us why some operations were inside this method and some were not. This commit moves all the code after the transaction into `ImmunisationImport#post_commit!`. Co-authored-by: Chris Lowis <chris.lowis@gofreerange.com>
1 parent 70d2da2 commit 5ab5fdc

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

app/models/immunisation_import.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ def process!
8989
end
9090

9191
post_commit!
92-
UpdatePatientsFromPDS.call(patients, queue: :imports)
93-
94-
TeamCachedCounts.new(team).reset_import_issues!
9592
end
9693

9794
private
@@ -227,5 +224,9 @@ def post_commit!
227224
.find_each do |vaccination_record|
228225
AlreadyHadNotificationSender.call(vaccination_record:)
229226
end
227+
228+
UpdatePatientsFromPDS.call(patients, queue: :imports)
229+
230+
TeamCachedCounts.new(team).reset_import_issues!
230231
end
231232
end

0 commit comments

Comments
 (0)