Skip to content

Commit

Permalink
Call schedule_republishing_workers on CallForEvidence
Browse files Browse the repository at this point in the history
In the event that all Sidekiq jobs are dropped, the
`requeue_all_jobs` rake task is intended to recreate all the
schedule-like jobs so that everything continues to be published
on time as expected.

Most editions can be scheduled for publishing as standard, but
editions that pull in the `Edition::HasOpeningAndClosingDates`
module (i.e. Consultation and CallForEvidence) also need to be
scheduled to publish on the opening or closing date. The rake
task was already doing this for Consultations, so should be doing
it for Calls for Evidence too.
  • Loading branch information
ChrisBAshton committed Nov 28, 2024
1 parent 172ac86 commit c841ab0
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/tasks/scheduled_publishing.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace :publishing do
end
end

desc "Clears all jobs then requeues all scheduled editions (intended for use after a db restore)"
desc "Clears all scheduled publishing jobs then requeues all scheduled editions (and open/close actions for editions that 'HasOpeningAndClosingDates'). This task is intended to be used after a db restore or in the event of the Sidekiq queue being emptied."
task requeue_all_jobs: :environment do
ScheduledPublishingWorker.dequeue_all

Expand All @@ -25,10 +25,14 @@ namespace :publishing do
end
puts ""

# Consultations work slightly different to scheduled editions
puts "Queuing consultation jobs"
# Consultations and Calls for Evidence work slightly different to scheduled editions
puts "Queuing Consultation jobs"
Consultation.open.or(Consultation.upcoming)
.find_each(&:schedule_republishing_workers)

puts "Queuing CallForEvidence jobs"
CallForEvidence.open.or(CallForEvidence.upcoming)
.find_each(&:schedule_republishing_workers)
end
end
end

0 comments on commit c841ab0

Please sign in to comment.