From 79f3958a0697d16c59b079da86db601bdf1abf90 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 16:53:35 -0300 Subject: [PATCH 1/4] fix: que no expone este metodo en activejob --- app/jobs/deploy_job.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/jobs/deploy_job.rb b/app/jobs/deploy_job.rb index a7f59afb..a5cda360 100644 --- a/app/jobs/deploy_job.rb +++ b/app/jobs/deploy_job.rb @@ -10,8 +10,6 @@ class DeployJob < ApplicationJob # Lanzar lo antes posible self.priority = 10 - # Intentar dentro de un minuto - self.retry_interval = 60 def handle_error(error) case error From 6c1dcf5ded419363690844a3a66eda6047c9d0bd Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:31:26 -0300 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20evitar=20errores=20de=20serializaci?= =?UTF-8?q?=C3=B3n=20#12998?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `que` falla silenciosamente cuando no puede serializar errores para enviar, que es la mayor parte de las veces. enviar los errores sincronicamente excepto los de airbrake --- app/lib/exception_notifier/gitlab_notifier.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/lib/exception_notifier/gitlab_notifier.rb b/app/lib/exception_notifier/gitlab_notifier.rb index 18bfc6d4..8152bb62 100644 --- a/app/lib/exception_notifier/gitlab_notifier.rb +++ b/app/lib/exception_notifier/gitlab_notifier.rb @@ -11,7 +11,12 @@ module ExceptionNotifier # @param [Exception] # @param [Hash] def call(exception, **options) - GitlabNotifierJob.perform_async(exception, **options) + case exception + when BacktraceJob::BacktraceException + GitlabNotifierJob.perform_later(exception, **options) + else + GitlabNotifierJob.perform_now(exception, **options) + end end end end From 482a63720793508f03e8756d575ea2d39021ff5d Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:33:07 -0300 Subject: [PATCH 3/4] fix: perform_later --- app/controllers/api/v1/contact_controller.rb | 2 +- app/jobs/maintenance_job.rb | 2 +- app/models/log_entry.rb | 2 +- app/services/site_service.rb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/api/v1/contact_controller.rb b/app/controllers/api/v1/contact_controller.rb index deacf4a7..d949dc30 100644 --- a/app/controllers/api/v1/contact_controller.rb +++ b/app/controllers/api/v1/contact_controller.rb @@ -18,7 +18,7 @@ module Api # Si todo salió bien, enviar los correos y redirigir al sitio. # El sitio nos dice a dónde tenemos que ir. - ContactJob.perform_async site.id, + ContactJob.perform_later site.id, params[:form], contact_params.to_h.symbolize_keys, params[:redirect] diff --git a/app/jobs/maintenance_job.rb b/app/jobs/maintenance_job.rb index 4c411d0e..c7a962f9 100644 --- a/app/jobs/maintenance_job.rb +++ b/app/jobs/maintenance_job.rb @@ -10,7 +10,7 @@ # bundle exec rails c # m = Maintenance.create message_en: 'reason', message_es: 'razón', # estimated_from: Time.now, estimated_to: Time.now + 1.hour -# MaintenanceJob.perform_async(maintenance_id: m.id) +# MaintenanceJob.perform_later(maintenance_id: m.id) # # Lo mismo para salir de mantenimiento, agregando el atributo # are_we_back: true al crear el Maintenance. diff --git a/app/models/log_entry.rb b/app/models/log_entry.rb index 1824da55..9685e0d0 100644 --- a/app/models/log_entry.rb +++ b/app/models/log_entry.rb @@ -11,7 +11,7 @@ class LogEntry < ApplicationRecord def resend return if sent - ContactJob.perform_async site_id, params[:form], params + ContactJob.perform_later site_id, params[:form], params end def params diff --git a/app/services/site_service.rb b/app/services/site_service.rb index 8ecc3f56..5d28bf91 100644 --- a/app/services/site_service.rb +++ b/app/services/site_service.rb @@ -5,7 +5,7 @@ SiteService = Struct.new(:site, :usuarie, :params, keyword_init: true) do def deploy site.enqueue! - DeployJob.perform_async site.id + DeployJob.perform_later site.id end # Crea un sitio, agrega un rol nuevo y guarda los cambios a la From 1e79e2687295d8c12ded65c0ccb2e82f8f144346 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 10 Apr 2023 17:38:16 -0300 Subject: [PATCH 4/4] fix: ignorar las excepciones de publicaciones duplicadas --- config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index d121bdbd..653ca8aa 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -147,7 +147,7 @@ Rails.application.configure do } config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', "noreply@sutty.nl") } - config.middleware.use ExceptionNotification::Rack, gitlab: {} + config.middleware.use ExceptionNotification::Rack, gitlab: {}, ignore_exceptions: (['DeployJob::DeployAlreadyRunningException'] + ExceptionNotifier.ignored_exceptions) Rails.application.routes.default_url_options[:host] = "panel.#{ENV.fetch('SUTTY', 'sutty.nl')}" Rails.application.routes.default_url_options[:protocol] = 'https'