Skip to content

Commit

Permalink
Merge pull request #1044 from alphagov/dependabot/bundler/govuk_sidek…
Browse files Browse the repository at this point in the history
…iq-9.0.1

Bump govuk_sidekiq from 8.0.1 to 9.0.1
  • Loading branch information
AgaDufrat authored Oct 23, 2024
2 parents 1c979e3 + c94cfac commit 349a50a
Show file tree
Hide file tree
Showing 28 changed files with 90 additions and 70 deletions.
24 changes: 13 additions & 11 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,11 @@ GEM
sentry-rails (~> 5.3)
sentry-ruby (~> 5.3)
statsd-ruby (~> 1.5)
govuk_sidekiq (8.0.1)
govuk_sidekiq (9.0.1)
gds-api-adapters (>= 19.1.0)
govuk_app_config (>= 1.1)
redis (< 5)
redis-namespace (~> 1.6)
sidekiq (~> 6.5, >= 6.5.12)
redis-client (>= 0.22.2)
sidekiq (~> 7.0, < 8)
hashdiff (1.1.1)
hashie (5.0.0)
http-accept (1.7.0)
Expand Down Expand Up @@ -585,9 +584,10 @@ GEM
ffi (~> 1.0)
rdoc (6.7.0)
psych (>= 4.0.0)
redis (4.8.1)
redis-namespace (1.11.0)
redis (>= 4)
redis (5.3.0)
redis-client (>= 0.22.0)
redis-client (0.22.2)
connection_pool
regexp_parser (2.9.2)
reline (0.5.10)
io-console (~> 0.5)
Expand Down Expand Up @@ -665,10 +665,12 @@ GEM
sidekiq (>= 3.0)
shoulda-matchers (6.4.0)
activesupport (>= 5.2.0)
sidekiq (6.5.12)
connection_pool (>= 2.2.5, < 3)
rack (~> 2.0)
redis (>= 4.5.0, < 5)
sidekiq (7.3.2)
concurrent-ruby (< 2)
connection_pool (>= 2.3.0)
logger
rack (>= 2.2.4)
redis-client (>= 0.22.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ContentImprovementController < ApplicationController
def create
feedback = ContentImprovementFeedback.new(feedback_params)
if feedback.valid?
ContentImprovementFeedbackWorker.perform_async(feedback_params)
ContentImprovementFeedbackJob.perform_async(feedback_params)
head :accepted
else
render json: { "errors" => feedback.errors.to_a }, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def create
export_request = FeedbackExportRequest.new(export_request_params)

if export_request.save
GenerateFeedbackCsvWorker.perform_async(export_request.id)
GenerateFeedbackCsvJob.perform_async(export_request.id)
head :accepted
else
render json: { "errors" => export_request.errors.to_a }, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AnonymousFeedback::GlobalExportRequestsController < ApplicationController
def create
export_request = GlobalExportRequest.new(global_export_request_params)
if export_request.valid?
GenerateGlobalExportCsvWorker.perform_async(global_export_request_params)
GenerateGlobalExportCsvJob.perform_async(global_export_request_params)
head :accepted
else
render json: { "errors" => export_request.errors.to_a }, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def create
request = LongFormContact.new(long_form_contact_params)

if request.valid?
LongFormContactWorker.perform_async(long_form_contact_params)
LongFormContactJob.perform_async(long_form_contact_params.to_h)
head :accepted
else
render json: { "errors" => request.errors.to_a }, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create
request = ProblemReport.new(problem_report_params)

if request.valid?
ProblemReportWorker.perform_async(problem_report_params)
ProblemReportJob.perform_async(problem_report_params.to_h)
head :accepted
else
render json: { "errors" => request.errors.to_a }, status: :unprocessable_entity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def create
request = ServiceFeedback.new(service_feedback_params)

if request.valid?
ServiceFeedbackWorker.perform_async(service_feedback_params)
ServiceFeedbackJob.perform_async(service_feedback_params.to_h)
head :accepted
else
render json: { "errors" => request.errors.to_a }, status: :unprocessable_entity
Expand Down
9 changes: 9 additions & 0 deletions app/sidekiq/content_improvement_feedback_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ContentImprovementFeedbackJob
include Sidekiq::Job

def perform(feedback_params)
ContentImprovementFeedback.create!(feedback_params)
end
end

ContentImprovementFeedbackWorker = ContentImprovementFeedbackJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ContentItemEnrichmentWorker
include Sidekiq::Worker
class ContentItemEnrichmentJob
include Sidekiq::Job

def perform(problem_report_id)
problem_report = ProblemReport.find(problem_report_id)
Expand All @@ -25,3 +25,5 @@ def build_orgs(org_hashes)
end
end
end

ContentItemEnrichmentWorker = ContentItemEnrichmentJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ContentItemPopulateDoctypeWorker
include Sidekiq::Worker
class ContentItemPopulateDoctypeJob
include Sidekiq::Job

def perform
content_store = GdsApi::ContentStore.new(Plek.find("content-store"))
Expand All @@ -17,3 +17,5 @@ def perform
Rails.logger.warn "There were errors with the following paths: #{document_type_errors.join(', ')}"
end
end

ContentItemPopulateDoctypeWorker = ContentItemPopulateDoctypeJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "s3_file_uploader"

class GenerateFeedbackCsvWorker
include Sidekiq::Worker
class GenerateFeedbackCsvJob
include Sidekiq::Job

def initialize(uploader: S3FileUploader.new)
@uploader = uploader
Expand All @@ -23,3 +23,5 @@ def perform(*args)
ExportNotification.notification_email(feedback_export_request.notification_email, feedback_export_request.url).deliver_now
end
end

GenerateFeedbackCsvWorker = GenerateFeedbackCsvJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "s3_file_uploader"

class GenerateGlobalExportCsvWorker
include Sidekiq::Worker
class GenerateGlobalExportCsvJob
include Sidekiq::Job

def initialize(uploader: S3FileUploader.new)
@uploader = uploader
Expand All @@ -26,3 +26,5 @@ def perform(export_params)
GlobalExportNotification.notification_email(export_params["notification_email"], feedback_export_request.url).deliver_now
end
end

GenerateGlobalExportCsvWorker = GenerateGlobalExportCsvJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
10 changes: 10 additions & 0 deletions app/sidekiq/long_form_contact_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class LongFormContactJob
include Sidekiq::Job

def perform(long_form_contact_params)
contact = LongFormContact.create!(long_form_contact_params)
ZendeskTicketJob.perform_async(contact.id)
end
end

LongFormContactWorker = LongFormContactJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
11 changes: 11 additions & 0 deletions app/sidekiq/problem_report_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class ProblemReportJob
include Sidekiq::Job

def perform(problem_report_params)
problem_report = ProblemReport.create!(problem_report_params)
ZendeskTicketJob.perform_async(problem_report.id)
ContentItemEnrichmentJob.perform_async(problem_report.id)
end
end

ProblemReportWorker = ProblemReportJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
9 changes: 9 additions & 0 deletions app/sidekiq/service_feedback_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class ServiceFeedbackJob
include Sidekiq::Job

def perform(service_feedback_params)
ServiceFeedback.new(service_feedback_params).save!
end
end

ServiceFeedbackWorker = ServiceFeedbackJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
require "zendesk/long_form_contact_ticket"
require "zendesk/problem_report_ticket"

class ZendeskTicketWorker
include Sidekiq::Worker
class ZendeskTicketJob
include Sidekiq::Job

def perform(anonymous_contact_id)
anonymous_contact = AnonymousContact.find(anonymous_contact_id)
Expand All @@ -19,3 +19,5 @@ def ticket_for(anonymous_contact)
end
end
end

ZendeskTicketWorker = ZendeskTicketJob ## TODO: Remove once queued jobs at the time of the upgrade are complete
7 changes: 0 additions & 7 deletions app/workers/content_improvement_feedback_worker.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/workers/long_form_contact_worker.rb

This file was deleted.

9 changes: 0 additions & 9 deletions app/workers/problem_report_worker.rb

This file was deleted.

7 changes: 0 additions & 7 deletions app/workers/service_feedback_worker.rb

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class PopulateDocumentTypeForContentItems < ActiveRecord::Migration[5.0]
def up
ContentItemPopulateDoctypeWorker.perform_async
ContentItemPopulateDoctypeJob.perform_async
end

def down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

context "posted with valid parameters" do
before do
expect(GenerateFeedbackCsvWorker).to receive(:perform_async).once.with(instance_of(Integer))
expect(GenerateFeedbackCsvJob).to receive(:perform_async).once.with(instance_of(Integer))
post :create,
params: {
export_request: {
Expand Down Expand Up @@ -40,7 +40,7 @@

context "posted with invalid parameters" do
before do
expect(GenerateFeedbackCsvWorker).to receive(:perform_async).never
expect(GenerateFeedbackCsvJob).to receive(:perform_async).never
post :create,
params: {
export_request: {
Expand All @@ -60,7 +60,7 @@

context "with backwards compatible `path_prefix` param" do
before do
expect(GenerateFeedbackCsvWorker).to receive(:perform_async).once.with(instance_of(Integer))
expect(GenerateFeedbackCsvJob).to receive(:perform_async).once.with(instance_of(Integer))
post :create,
params: {
export_request:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

context "with valid parameters" do
it "succeeds" do
expect(GenerateGlobalExportCsvWorker).to receive(:perform_async).once
expect(GenerateGlobalExportCsvJob).to receive(:perform_async).once

response = post :create,
params: {
Expand All @@ -24,7 +24,7 @@

context "with invalid parameters" do
it "fails" do
expect(GenerateGlobalExportCsvWorker).not_to receive(:perform_async)
expect(GenerateGlobalExportCsvJob).not_to receive(:perform_async)

response = post :create,
params: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require "rails_helper"
require "gds_api/test_helpers/content_store"

describe ContentItemEnrichmentWorker do
describe ContentItemEnrichmentJob do
include GdsApi::TestHelpers::ContentStore

subject { ContentItemEnrichmentWorker.new }
subject { ContentItemEnrichmentJob.new }

context "for a problem report about a piece of content we can't determine the organisation for" do
let(:problem_report) { create(:problem_report, path: "/unknown-org-page") }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "rails_helper"

describe GenerateFeedbackCsvWorker, type: :worker do
describe GenerateFeedbackCsvJob, type: :worker do
describe "#perform" do
let(:feedback_export_request) { create(:feedback_export_request) }
let(:uploader) { instance_double(S3FileUploader) }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require "gds_api/test_helpers/content_store"

describe ContentItemEnrichmentWorker do
describe ContentItemEnrichmentJob do
include GdsApi::TestHelpers::ContentStore

let(:raw_path) { "my-magic-govuk-endpoint" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require "gds_api/test_helpers/content_store"

describe ContentItemPopulateDoctypeWorker do
describe ContentItemPopulateDoctypeJob do
include GdsApi::TestHelpers::ContentStore

it "updates every content item's `document_type`" do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "rails_helper"
require "date"

describe GenerateGlobalExportCsvWorker, type: :worker do
describe GenerateGlobalExportCsvJob, type: :worker do
let(:uploader) { instance_double(S3FileUploader) }
subject(:worker) { described_class.new(uploader:) }

Expand Down

0 comments on commit 349a50a

Please sign in to comment.