Skip to content

Commit 2eb5611

Browse files
committed
Use Sidekiq for scheduled jobs
This replaces the usage of Good Job to run scheduled jobs to use Sidekiq instead. Jira-Issue: MAV-1929
1 parent ebb846f commit 2eb5611

File tree

6 files changed

+55
-95
lines changed

6 files changed

+55
-95
lines changed

config/cron_jobs.rb

Lines changed: 0 additions & 75 deletions
This file was deleted.

config/environments/production.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
require "active_support/core_ext/integer/time"
44

5-
require_relative "../cron_jobs"
6-
75
Rails.application.configure do
86
# Settings specified here will take precedence over those in config/application.rb.
97

@@ -96,7 +94,4 @@
9694
# ]
9795
# Skip DNS rebinding protection for the default health check endpoint.
9896
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
99-
100-
config.good_job.enable_cron = true
101-
config.good_job.cron = CRON_JOBS
10297
end

config/environments/staging.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
# frozen_string_literal: true
22

33
require_relative "production"
4-
5-
Rails.application.configure { config.good_job.cron = CRON_JOBS }

config/routes.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require "sidekiq/web"
4+
require "sidekiq-scheduler/web"
45
require "sidekiq/throttled/web"
56

67
Rails.application.routes.draw do

config/sidekiq.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,57 @@
88
- patients
99
- pds
1010
- immunisations_api
11+
:scheduler:
12+
:schedule:
13+
clinic_session_invitations:
14+
cron: "0 9 * * *"
15+
class: EnqueueClinicSessionInvitationsJob
16+
description: Send school clinic invitation emails to parents
17+
invalidate_self_consents:
18+
cron: "0 2 * * *"
19+
class: InvalidateSelfConsentsJob
20+
description: Invalidate all self-consents and associated triage for the previous day
21+
patients_aged_out_of_school:
22+
cron: "0 5 * * *"
23+
class: PatientsAgedOutOfSchoolJob
24+
description: Moves patients who have aged out of their school to unknown school
25+
patients_clear_registration:
26+
cron: "15 5 * * *"
27+
class: PatientsClearRegistrationJob
28+
description: Clears the registration of patients for the previous academic year
29+
patients_refused_consent_already_vaccinated:
30+
cron: "30 5 * * *"
31+
class: PatientsRefusedConsentAlreadyVaccinatedJob
32+
description: Record already vaccinated for patients who refused consent in the previous academic year for that reason
33+
remove_import_csv:
34+
cron: "0 1 * * *"
35+
class: RemoveImportCSVJob
36+
description: Remove CSV data from old cohort and immunisation imports
37+
school_consent_requests:
38+
cron: "0 16 * * *"
39+
class: EnqueueSchoolConsentRequestsJob
40+
description: Send school consent request emails to parents for each session
41+
school_consent_reminders:
42+
cron: "15 16 * * *",
43+
class: EnqueueSchoolConsentRemindersJob
44+
description: Send school consent reminder emails to parents for each session
45+
school_session_reminders:
46+
cron: "0 9 * * *"
47+
class: SendSchoolSessionRemindersJob
48+
description: Send school session reminder emails to parents
49+
status_updater:
50+
cron: "0 3 * * *"
51+
class: StatusUpdaterJob
52+
description: Updates the status of all patients
53+
trim_active_record_sessions:
54+
cron: "0 2 * * *"
55+
class: TrimActiveRecordSessionsJob
56+
description: Remove ActiveRecord sessions older than 30 days
57+
update_patients_from_pds:
58+
cron: "0 0,6,12,18 * * *"
59+
class: EnqueueUpdatePatientsFromPDSJob
60+
description: Keep patient details up to date with PDS
61+
vaccination_confirmations:
62+
cron: "0 13,16,19 * * *"
63+
class: SendVaccinationConfirmationsJob
64+
description: Send vaccination confirmation emails to parents

spec/lib/cron_jobs_spec.rb

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)