From 94d7b32ce6fc4e4b2fbcb89717655310876086ba Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Apr 2024 14:16:01 -0300 Subject: [PATCH] fix: handle_error no es compatible con activejob --- app/jobs/application_job.rb | 5 +++++ app/jobs/git_push_job.rb | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index 06690c53..8b85358c 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -4,6 +4,11 @@ class ApplicationJob < ActiveJob::Base include Que::ActiveJob::JobExtensions + # Si falla por cualquier cosa informar y descartar + discard_on(Exception) do |error| + ExceptionNotifier.notify_exception(error, data: { site: site.name }) + end + private def site diff --git a/app/jobs/git_push_job.rb b/app/jobs/git_push_job.rb index 7c3eb236..260e3476 100644 --- a/app/jobs/git_push_job.rb +++ b/app/jobs/git_push_job.rb @@ -3,17 +3,13 @@ # Permite pushear los cambios cada vez que se # hacen commits en un sitio class GitPushJob < ApplicationJob + attr_reader :site + # @param :site [Site] # @return [nil] def perform(site) + @site = site + site.repository.push if site.repository.origin end - - # Reportar una sola vez para que podamos resolver el problema, pero - # reportarlo igual. - # - # @return [Bool] - def handle_error(_) - expire - end end