Activestorage с ошибкой десериализации гема activejob и apartment

Я пытаюсь использовать гем Apartment с activestorage и activejob, но у меня возникает ошибка с задачей анализа activestorage по умолчанию.

У меня есть простой контроллер, который загружает и хранит файлы. Я получаю следующую ошибку при запуске sidekiq. Обычно задание анализа по умолчанию в activestorage не выполняется.

WARN: ActiveJob::DeserializationError: Error while trying to deserialize arguments: Couldn't find ActiveStorage::Blob with 'id'=3

Полная ошибка

2018-09-10T07:24:41.583Z 6956 TID-gojpxrbzw ActiveStorage::AnalyzeJob JID-9367cb9f539860eb6b372f64 INFO: start
2018-09-10T07:24:41.586Z 6956 TID-gojpxrbzw ActiveStorage::AnalyzeJob JID-9367cb9f539860eb6b372f64 INFO: fail: 0.003 sec
2018-09-10T07:24:41.586Z 6956 TID-gojpxrbzw WARN: {"context":"Job raised exception","job":{"class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","wrapped":"ActiveStorage::AnalyzeJob","queue":"default","args":[{"job_class":"ActiveStorage::AnalyzeJob","job_id":"7515b86b-ba9e-4d7e-8aaf-37dec34252be","provider_job_id":null,"queue_name":"default","priority":null,"arguments":[{"_aj_globalid":"gid://importer-v2/ActiveStorage::Blob/3"}],"executions":0,"locale":"en"}],"retry":true,"jid":"9367cb9f539860eb6b372f64","created_at":1536563963.822738,"enqueued_at":1536564281.5834057,"error_message":"Error while trying to deserialize arguments: Couldn't find ActiveStorage::Blob with 'id'=3","error_class":"ActiveJob::DeserializationError","failed_at":1536563971.316094,"retry_count":3,"retried_at":1536564147.3845608},"jobstr":"{\"class\":\"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper\",\"wrapped\":\"ActiveStorage::AnalyzeJob\",\"queue\":\"default\",\"args\":[{\"job_class\":\"ActiveStorage::AnalyzeJob\",\"job_id\":\"7515b86b-ba9e-4d7e-8aaf-37dec34252be\",\"provider_job_id\":null,\"queue_name\":\"default\",\"priority\":null,\"arguments\":[{\"_aj_globalid\":\"gid://importer-v2/ActiveStorage::Blob/3\"}],\"executions\":0,\"locale\":\"en\"}],\"retry\":true,\"jid\":\"9367cb9f539860eb6b372f64\",\"created_at\":1536563963.822738,\"enqueued_at\":1536564281.5834057,\"error_message\":\"Error while trying to deserialize arguments: Couldn't find ActiveStorage::Blob with 'id'=3\",\"error_class\":\"ActiveJob::DeserializationError\",\"failed_at\":1536563971.316094,\"retry_count\":3,\"retried_at\":1536564147.3845608}"}
2018-09-10T07:24:41.586Z 6956 TID-gojpxrbzw WARN: ActiveJob::DeserializationError: Error while trying to deserialize arguments: Couldn't find ActiveStorage::Blob with 'id'=3
2018-09-10T07:24:41.586Z 6956 TID-gojpxrbzw WARN: /home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:346:in `raise_record_not_found_exception!'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:454:in `find_one'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:433:in `find_with_ids'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/relation/finder_methods.rb:69:in `find'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/querying.rb:5:in `find'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/core.rb:160:in `find'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:130:in `locate'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:155:in `block in locate'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:165:in `block in unscoped'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/scoping/default.rb:34:in `block in unscoped'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/relation.rb:281:in `scoping'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activerecord-5.2.0/lib/active_record/scoping/default.rb:34:in `unscoped'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:165:in `unscoped'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:155:in `locate'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/globalid-0.4.1/lib/global_id/locator.rb:17:in `locate'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/arguments.rb:101:in `deserialize_global_id'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/arguments.rb:87:in `deserialize_argument'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/arguments.rb:41:in `block in deserialize'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/arguments.rb:41:in `map'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/arguments.rb:41:in `deserialize'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/core.rb:143:in `deserialize_arguments'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/core.rb:133:in `deserialize_arguments_if_needed'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/execution.rb:34:in `perform_now'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/execution.rb:24:in `block in execute'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/railtie.rb:28:in `block (4 levels) in <class:Railtie>'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:87:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/reloader.rb:73:in `block in wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:83:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/reloader.rb:72:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/railtie.rb:27:in `block (3 levels) in <class:Railtie>'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `instance_exec'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/callbacks.rb:136:in `run_callbacks'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/execution.rb:22:in `execute'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activejob-5.2.0/lib/active_job/queue_adapters/sidekiq_adapter.rb:42:in `perform'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:185:in `execute_job'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:167:in `block (2 levels) in process'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/middleware/chain.rb:128:in `block in invoke'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/middleware/chain.rb:133:in `invoke'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:166:in `block in process'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:137:in `block (6 levels) in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/job_retry.rb:98:in `local'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:136:in `block (5 levels) in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/rails.rb:42:in `block in call'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:87:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/reloader.rb:73:in `block in wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/execution_wrapper.rb:87:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/activesupport-5.2.0/lib/active_support/reloader.rb:72:in `wrap'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/rails.rb:41:in `call'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:132:in `block (4 levels) in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:217:in `stats'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:127:in `block (3 levels) in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/job_logger.rb:8:in `call'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:126:in `block (2 levels) in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/job_retry.rb:73:in `global'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:125:in `block in dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/logging.rb:48:in `with_context'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/logging.rb:42:in `with_job_hash_context'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:124:in `dispatch'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:165:in `process'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:83:in `process_one'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/processor.rb:71:in `run'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/util.rb:16:in `watchdog'
/home/ubuntu/.rvm/gems/ruby-2.5.1@importer/gems/sidekiq-5.2.1/lib/sidekiq/util.rb:25:in `block in safe_thread'

Итак, мой вопрос: как получить activestorage, чтобы использовать правильного арендатора при выполнении задания анализа при использовании жемчужины квартиры?

0
0
847
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий

Я нашел исправление для этого. Добавление камня apartment-sidekiq решило эту проблему.

https://github.com/influitive/apartment-sidekiq

Другие вопросы по теме