1

我想document doc在后台处理将 's(files) 上传到 S3,但由于某种原因,它对我不起作用。我目前正在本地运行它。

这是我的设置:

class DocUploader < CarrierWave::Uploader::Base

# Include RMagick or MiniMagick support:
  include CarrierWave::MiniMagick
  include ::CarrierWave::Backgrounder::Delay

# Choose what kind of storage to use for this uploader:
  storage :fog

end

# /config/initializers/carrierwave_backgrounder.rb

CarrierWave::Backgrounder.configure do |c|
  c.backend :sidekiq, queue: :carrierwave
end

# 文档控制器.rb

def document_params
  params.require(:document).permit(
  ..., :doc, :doc_tmp, :remove_doc, ...
)
end

#sidekiq.yml

---
:queues:
 - [default,5]
 - [carrierwave,5]

sidekiq使用以下命令运行:

bundle exec sidekiq

当我尝试使用以下设置上传时:(store_in_background docdocument

#  doc                 :string  
#  doc_processing      :boolean          default(FALSE), not null  
#  doc_tmp             :string  

class Document < ActiveRecord::Base

  mount_uploader :doc, DocUploader
  store_in_background :doc
  # process_in_background :doc
  attr_accessor :doc_tmp
end  

它似乎没有在 sidekiq 的后台排队任何工作,并且doc保存是在进程中完成的,需要很长时间。

有什么建议么?

4

1 回答 1

0

试试 sidekiq -q carrierwave 在哪里可以指定要在开发中运行的队列。

于 2017-06-12T22:01:04.770 回答