From ad9f9c3d618eb7cba2834e350a03dd7c7804bd0c Mon Sep 17 00:00:00 2001 From: f Date: Wed, 13 Mar 2024 16:27:33 -0300 Subject: [PATCH] fixup! fix: serializar correctamente --- app/models/que_job.rb | 5 +++++ db/migrate/20240313192134_fix_fetch_jobs.rb | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 app/models/que_job.rb create mode 100644 db/migrate/20240313192134_fix_fetch_jobs.rb diff --git a/app/models/que_job.rb b/app/models/que_job.rb new file mode 100644 index 00000000..0bfffc92 --- /dev/null +++ b/app/models/que_job.rb @@ -0,0 +1,5 @@ +# frozen_string_literal: true + +require 'que/active_record/model' + +class QueJob < Que::ActiveRecord::Model; end diff --git a/db/migrate/20240313192134_fix_fetch_jobs.rb b/db/migrate/20240313192134_fix_fetch_jobs.rb new file mode 100644 index 00000000..3b9d4ad8 --- /dev/null +++ b/db/migrate/20240313192134_fix_fetch_jobs.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class FixFetchJobs < ActiveRecord::Migration[6.1] + def up + QueJob.where("last_error_message like '%ActiveJob::DeserializationError%'").find_each do |job| + job.error_count = 0 + job.run_at = time.now + + job.args.first['arguments'].first['_aj_ruby2_keywords'].delete('object') + job.args.first['arguments'].first['_aj_ruby2_keywords'] << 'object_id' + + object = job.args.first['arguments'].first.delete('object')['_aj_globalid'] + job.args.first['arguments'].first['object_id'] = object.split('/').last + + job.save + end + end + + def down; end +end