From 39e997d0ca8ad2d41f7c361f458c08f669c679dd Mon Sep 17 00:00:00 2001 From: f Date: Tue, 28 Mar 2023 20:21:52 -0300 Subject: [PATCH] BREAKING CHANGE: deprecar sucker punch en favor de que --- Gemfile | 2 +- Gemfile.lock | 8 ++------ app/jobs/application_job.rb | 2 +- config/environments/production.rb | 2 +- config/initializers/sucker_punch.rb | 6 ------ db/migrate/20230328231029_create_que_tables.rb | 12 ++++++++++++ 6 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 config/initializers/sucker_punch.rb create mode 100644 db/migrate/20230328231029_create_que_tables.rb diff --git a/Gemfile b/Gemfile index f3799638..7ff904dd 100644 --- a/Gemfile +++ b/Gemfile @@ -68,7 +68,7 @@ gem 'rollups', git: 'https://github.com/fauno/rollup.git', branch: 'update' gem 'rubyzip' gem 'rugged' gem 'concurrent-ruby-ext' -gem 'sucker_punch' +gem 'que' gem 'symbol-fstring', require: 'fstring/all' gem 'terminal-table' gem 'validates_hostname' diff --git a/Gemfile.lock b/Gemfile.lock index abaf45c9..ac8f6870 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,9 +119,6 @@ GEM colorator (1.1.0) commonmarker (0.21.2-x86_64-linux-musl) ruby-enum (~> 0.5) - concurrent-ruby (1.1.9) - concurrent-ruby-ext (1.1.9-x86_64-linux-musl) - concurrent-ruby (= 1.1.9) crass (1.0.6) database_cleaner (2.0.1) database_cleaner-active_record (~> 2.0.0) @@ -374,6 +371,7 @@ GEM pundit (2.1.1) activesupport (>= 3.0.0) racc (1.6.0-x86_64-linux-musl) + que (2.2.0) rack (2.2.3) rack-cors (1.1.1) rack (>= 2.0.0) @@ -510,8 +508,6 @@ GEM sprockets (>= 3.0.0) sqlite3 (1.4.2-x86_64-linux-musl) stackprof (0.2.17-x86_64-linux-musl) - sucker_punch (3.0.1) - concurrent-ruby (~> 1.0) sutty-archives (2.5.4) jekyll (>= 3.6, < 5.0) sutty-liquid (0.7.4) @@ -619,6 +615,7 @@ DEPENDENCIES pry puma pundit + que rack-cors rack-mini-profiler rails (~> 6) @@ -638,7 +635,6 @@ DEPENDENCIES spring-watcher-listen (~> 2.0.0) sqlite3 stackprof - sucker_punch sutty-liquid (>= 0.7.3) symbol-fstring terminal-table diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index f3673f0a..06690c53 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -2,7 +2,7 @@ # Base para trabajos class ApplicationJob < ActiveJob::Base - include SuckerPunch::Job + include Que::ActiveJob::JobExtensions private diff --git a/config/environments/production.rb b/config/environments/production.rb index d121bdbd..ed737146 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -66,7 +66,7 @@ Rails.application.configure do # Use a real queuing backend for Active Job (and separate queues per # environment) - config.active_job.queue_adapter = :sucker_punch + config.active_job.queue_adapter = :que config.active_job.queue_name_prefix = "sutty_#{Rails.env}" config.action_mailer.perform_caching = false diff --git a/config/initializers/sucker_punch.rb b/config/initializers/sucker_punch.rb deleted file mode 100644 index 865af32d..00000000 --- a/config/initializers/sucker_punch.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -# Enviar una notificación cuando falla una tarea -SuckerPunch.exception_handler = lambda { |ex, _klass, _args| - ExceptionNotifier.notify_exception(ex) -} diff --git a/db/migrate/20230328231029_create_que_tables.rb b/db/migrate/20230328231029_create_que_tables.rb new file mode 100644 index 00000000..1ed929f7 --- /dev/null +++ b/db/migrate/20230328231029_create_que_tables.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +# Que +class CreateQueTables < ActiveRecord::Migration[6.1] + def up + Que.migrate! version: 7 + end + + def down + Que.migrate! version: 0 + end +end