等待图像处理的最佳实践?
Best practice for waiting for image processing?
我有一个使用 Carrierwave 和 CarrierwaveBackgrounder 进行图像处理的模型:
mount_uploader :background, BackgroundUploader
process_in_background :background
因此,当创建资源时,我想等待后台程序完成图像处理,然后重定向到新创建的资源。
我现在能想到的一切对我来说都很脏:
sleep(2.0) while @page.background.large.file.exists?
但这甚至可能导致超时。
有什么other/better建议吗?
麻烦安装和使用额外的插件在后台处理您的图像,然后再麻烦反转所有背景效果,这有什么意义呢?
因此,"wait for image processing" 的最佳做法是在不需要时一开始就不要使用它(恕我直言)。
@page.process_background_upload = true
成功了。
我有一个使用 Carrierwave 和 CarrierwaveBackgrounder 进行图像处理的模型:
mount_uploader :background, BackgroundUploader
process_in_background :background
因此,当创建资源时,我想等待后台程序完成图像处理,然后重定向到新创建的资源。
我现在能想到的一切对我来说都很脏:
sleep(2.0) while @page.background.large.file.exists?
但这甚至可能导致超时。
有什么other/better建议吗?
麻烦安装和使用额外的插件在后台处理您的图像,然后再麻烦反转所有背景效果,这有什么意义呢?
因此,"wait for image processing" 的最佳做法是在不需要时一开始就不要使用它(恕我直言)。
@page.process_background_upload = true
成功了。