我用CarrierWave和CarrierWaveBackgrounder Sidekiq上传我的图像到S3在后台。除了一件事情之外,此工作正常:在我提交表单后,图像在Sidekiq中排队并处理,但页面重新加载比后台作业更快,导致上传的图像上出现404错误。在另一页面刷新后,图像通常显示出来。显示图像上传到S3与Carrierwave/Sidekiq提交表格后
我想知道是否有办法显示一个tmp文件(我的数据库中有一个image_tmp列,似乎在处理/上传时存储文件路径),或者在处理后重新加载我的映像已经完成了。
我可以轮询我的数据库'image_processing'变成true,但这似乎有点像浪费了请求。
我的User类的相关部分:
mount_uploader :profile_image, ProfileImageUploader
process_in_background :profile_image
store_in_background :profile_image
ProfileImageUploader包括新闻背景
class ProfileImageUploader < CarrierWave::Uploader::Base
include ::CarrierWave::Backgrounder::Delay
include CarrierWave::MiniMagick
我的数据库有profile_image_processing
和profile_image_tmp
领域,以及,当然,一个profile_image
列。