如何解决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 举报,一经查实,本站将立刻删除。