delay_paperclip with sidekiq 返回 NoMethodError: undefined method `fetch' for nil:NilClass

问题描述

我正在使用 delayed_paperclip 并且我已经尝试使用认的 ActiveJob 并且效果很好。但是,它是同步运行的,因此它会在响应之前等待作业完成,因此我想将队列移至 sidekiq。

但是现在我已经将队列移动到 sidekiq,它给了我一个错误

NoMethodError: undefined method `fetch' for nil:NilClass

我试图寻找答案,但我没有找到。

我将此添加到我的 application.rb

config.active_job.queue_adapter = :sidekiq

我的图像模型

    has_attached_file :attachment,styles: {
                      mini: '48x48#',thumb: '75x95#',tile: '212x212#',tile_portrait: '230x327#',large_tile: '300x300#',small: '100x100#',product: '240x240',large: '360x460#',large_portrait: '460x654#',zoom_portrait: '690x981#'
                  },process_in_background :attachment,processing_image_url: :processing_image_fallback

    def processing_image_fallback
      options = attachment.options
      options[:interpolator].interpolate(options[:url],attachment,:original)
    end

有人知道是什么问题吗?或者有没有一种方法可以只使用 ActiveJob,但如何让它在后台处理回形针?

这里也是我的图片上传代码

def create_images
  return if context.image == {}
  context.images.each do |key,image|
    new_image_record = Image.create(
    kind: context.type
  ) #what I want to achieve: move on to next after creation 
  new_image_record.attachment = image
  new_image_record.save #job runs here. hoping this will run in the background or be moved to sidekiq
end

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...