CarrierWave Backgrounder进程使拒绝访问s3图像 [英] CarrierWave Backgrounder process leaves denied access to s3 image

查看:60
本文介绍了CarrierWave Backgrounder进程使拒绝访问s3图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前的Sidekiq设置包括以下内容,正在处理图像,但是在后台未执行任何操作。该页面需要花费10秒钟的时间加载,然后新的图像将以以下路径显示在重定向的页面上。
https:// d9vwx0ll7rhpx .cloudfront.net / development / photo / image / product_thumb / product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg

My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg

我希望此过程能够

def create
@photo = Photo.new(photo_params)
if @photo.save
  UploadsWorker.perform_async(@photo.id, photo_params)
  flash[:notice] = "Your new photograph is being processed."
  redirect_to photographer_listings_path(@photog)
else
  flash[:notice] =  "Check the fields marked with an orange flag."
  render 'new'
end

end

class UploadsWorker
 include Sidekiq::Worker

 def perform(photo_id, photo_params)
  photo = Photo.find(photo_id)
  photo.image = photo_params["image"]
  photo.save
end

end

我反而尝试使用CarrierWave Backgrounder gem,但是发现没有进行版本处理。代码运行了,但是保存新记录后,页面重定向后我没有图像。

I instead tried to use the CarrierWave Backgrounder gem, but found that the version processing doesnt take place. The code runs but I am left with no image on the page redirect after a new record saves.

在查看Sidekiq Web界面时,我看到的工作是正在运行,然后完成。

When looking at the Sidekiq web interface, I can see that the job is being run and then completes.

但是我留下的图像(在同一目录中)被拒绝访问。

However I am left with an image ( within the same directory) that has denied access.

奇怪的是不使用gem时看到顶部显示的网址是有效的。

Strange that occurs seeing the url shown at the top when not using the gem was valid.

https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product/thumb/product_thumb_a9cf111f-c93a-4ec3-b1170 jpg

推荐答案

我必须使用store_in_background而不是process_in_background才能将图像正确上传到s3

I had to use store_in_background rather than process_in_background in order for the image to be properly uploaded to s3

这篇关于CarrierWave Backgrounder进程使拒绝访问s3图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆