diff --git a/Gemfile b/Gemfile index 70131c68b55..d865a112c2e 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,7 @@ gem 'faker' gem 'faraday-retry' gem 'fugit' gem 'foundation_emails' -gem 'good_job', '~> 3.0' +gem 'good_job', '~> 4.0' gem 'http_accept_language' gem 'identity-hostdata', github: '18F/identity-hostdata', tag: 'v4.0.0' gem 'identity-logging', github: '18F/identity-logging', tag: 'v0.1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 149c90bb090..be007c550d2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -339,13 +339,13 @@ GEM ffi (~> 1.0) globalid (1.2.1) activesupport (>= 6.1) - good_job (3.99.1) - activejob (>= 6.0.0) - activerecord (>= 6.0.0) - concurrent-ruby (>= 1.0.2) - fugit (>= 1.1) - railties (>= 6.0.0) - thor (>= 0.14.1) + good_job (4.4.2) + activejob (>= 6.1.0) + activerecord (>= 6.1.0) + concurrent-ruby (>= 1.3.1) + fugit (>= 1.11.0) + railties (>= 6.1.0) + thor (>= 1.0.0) google-protobuf (4.28.2) bigdecimal rake (>= 13) @@ -357,7 +357,7 @@ GEM htmlbeautifier (1.4.3) htmlentities (4.3.4) http_accept_language (2.1.1) - i18n (1.14.5) + i18n (1.14.6) concurrent-ruby (~> 1.0) i18n-tasks (1.0.12) activesupport (>= 4.0.2) @@ -372,7 +372,7 @@ GEM terminal-table (>= 1.5.1) ice_nine (0.11.2) io-console (0.7.2) - irb (1.13.2) + irb (1.14.1) rdoc (>= 4.0.0) reline (>= 0.4.2) jmespath (1.6.2) @@ -743,7 +743,7 @@ GEM xpath (3.2.0) nokogiri (~> 1.8) yard (0.9.36) - zeitwerk (2.6.16) + zeitwerk (2.7.1) zlib (3.0.0) zonebie (0.6.1) zxcvbn (0.1.9) @@ -789,7 +789,7 @@ DEPENDENCIES faraday-retry foundation_emails fugit - good_job (~> 3.0) + good_job (~> 4.0) http_accept_language i18n-tasks (~> 1.0) identity-hostdata! diff --git a/app/jobs/good_job_v4_ready_job.rb b/app/jobs/good_job_v4_ready_job.rb deleted file mode 100644 index 0c8b9a41fd4..00000000000 --- a/app/jobs/good_job_v4_ready_job.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -class GoodJobV4ReadyJob < ApplicationJob - queue_as :default - - def perform - IdentityJobLogSubscriber.new.logger.info( - { - name: 'good_job_v4_ready', - ready: GoodJob.v4_ready?, - }.to_json, - ) - - true - end -end diff --git a/config/initializers/job_configurations.rb b/config/initializers/job_configurations.rb index be5602d67ce..ce6dfebcb2b 100644 --- a/config/initializers/job_configurations.rb +++ b/config/initializers/job_configurations.rb @@ -164,11 +164,6 @@ class: 'ThreatMetrixJsVerificationJob', cron: cron_1h, }, - # Periodically check whether we can upgrade to GoodJob V4 - good_job_v4_ready: { - class: 'GoodJobV4ReadyJob', - cron: cron_1h, - }, # Reject profiles that have been in fraud_review_pending for 30 days fraud_rejection: { class: 'FraudRejectionDailyJob', diff --git a/db/worker_jobs_migrate/20241022162624_add_jobs_finished_at_to_good_job_batches.rb b/db/worker_jobs_migrate/20241022162624_add_jobs_finished_at_to_good_job_batches.rb new file mode 100644 index 00000000000..dc0d978bb7e --- /dev/null +++ b/db/worker_jobs_migrate/20241022162624_add_jobs_finished_at_to_good_job_batches.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +class AddJobsFinishedAtToGoodJobBatches < ActiveRecord::Migration[7.1] + def change + reversible do |dir| + dir.up do + # Ensure this incremental update migration is idempotent + # with monolithic install migration. + return if connection.column_exists?(:good_job_batches, :jobs_finished_at) + end + end + + safety_assured do + change_table :good_job_batches do |t| + t.datetime :jobs_finished_at + end + end + end +end diff --git a/db/worker_jobs_schema.rb b/db/worker_jobs_schema.rb index 3e6fa136f59..2ce7f8fc09c 100644 --- a/db/worker_jobs_schema.rb +++ b/db/worker_jobs_schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.2].define(version: 2024_10_21_192437) do +ActiveRecord::Schema[7.2].define(version: 2024_10_22_162624) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" enable_extension "plpgsql" @@ -28,6 +28,7 @@ t.datetime "enqueued_at" t.datetime "discarded_at" t.datetime "finished_at" + t.datetime "jobs_finished_at" end create_table "good_job_executions", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| diff --git a/spec/jobs/good_job_v4_ready_job_spec.rb b/spec/jobs/good_job_v4_ready_job_spec.rb deleted file mode 100644 index 0a5c60645bb..00000000000 --- a/spec/jobs/good_job_v4_ready_job_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -require 'rails_helper' - -RSpec.describe GoodJobV4ReadyJob, type: :job do - describe '#perform' do - it 'logs goodjob v4 readiness' do - expect(Rails.logger).to receive(:info) do |str| - msg = JSON.parse(str, symbolize_names: true) - expect(msg).to eq( - { - name: 'good_job_v4_ready', - ready: GoodJob.v4_ready?, - }, - ) - end - - GoodJobV4ReadyJob.new.perform - end - end -end