Skip to content

Commit 698a102

Browse files
misakaalistair-white-horne-tng
authored andcommitted
Fix Mavis CLI vaccination-records sync
The `.update!` to change the `...pending_at` time was triggering a sidekiq job, which was causing a double sync.
1 parent 057e29d commit 698a102

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • app/lib/mavis_cli/vaccination_records

app/lib/mavis_cli/vaccination_records/sync.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,11 @@ def call(vaccination_record_id:, **)
3030
return
3131
end
3232

33-
vaccination_record.update!(
34-
nhs_immunisations_api_sync_pending_at: Time.current
33+
# Do not trigger the sync through the commit hook as we want to perform
34+
# the sync synchronously instead of enqueueing a background job.
35+
vaccination_record.update_columns(
36+
nhs_immunisations_api_sync_pending_at: Time.current,
37+
touch: true
3538
)
3639
NHS::ImmunisationsAPI.sync_immunisation(vaccination_record)
3740
puts "Successfully synced vaccination record #{vaccination_record_id}"

0 commit comments

Comments
 (0)