Merge pull request #10271 from demarches-simplifiees/sidekiq_part_of_api_entreprise

Tech: déplace APIEntreprise vers sidekiq
This commit is contained in:
LeSim 2024-04-09 12:57:12 +00:00 committed by GitHub
commit f5397268a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 2 deletions

View file

@ -126,7 +126,7 @@ class APIEntreprise::API
elsif response.code == 400
raise Error::BadFormatRequest.new(response)
elsif response.code == 502
raise Error::BadGateway.new(response)
raise Error::BadGateway.new(response)
elsif response.code == 503
raise Error::ServiceUnavailable.new(response)
elsif response.timed_out?

View file

@ -6,7 +6,7 @@ class APIEntreprise::API::Error < ::StandardError
msg = <<~TEXT
url: #{uri.host}#{uri.path}
HTTP error code: #{response.code}
body: #{CGI.escape(response.body)}
body: #{response.body}
curl message: #{response.return_message}
total time: #{response.total_time}
connect time: #{response.connect_time}

View file

@ -24,6 +24,11 @@ if ENV.has_key?('REDIS_SIDEKIQ_SENTINELS')
if ENV['SKIP_RELIABLE_FETCH'].blank?
Sidekiq::ReliableFetch.setup_reliable_fetch!(config)
end
config.capsule('api_entreprise') do |cap|
cap.concurrency = 1
cap.queues = ['api_entreprise']
end
end
Sidekiq.configure_client do |config|

View file

@ -57,5 +57,9 @@ if Rails.env.production? && SIDEKIQ_ENABLED
class Cron::CronJob < ApplicationJob
self.queue_adapter = :sidekiq
end
class APIEntreprise::Job < ApplicationJob
self.queue_adapter = :sidekiq
end
end
end