我有一个在Heroku中运行的Rails应用程序,该应用程序支持通过Carrierwave上传图像,并上传到Google Cloud Storage。
我现在正在实施`data.table` solution
**sample data**
library(data.table)
DT <- fread("Var1 | V1 | V2
0060a00000fUbAnAAK |S 2 |S 5")
**code**
#melt DT to long format
DT <- melt( DT, id.vars = "Var1", value.name = "stage")
#get stage as numeric and clean up unwanted columns
DT[, `:=`(variable = NULL, stage = as.numeric( gsub("[^0-9]", "", stage)))]
#create new stages based on minimum and maximum stage per Var1-value
DT[, .( V1 = paste0( "S ", min(stage):(max(stage)-1) ),
V2 = paste0( "S ", (min(stage)+1):max(stage) ) ), by = .(Var1)][]
**output**
# Var1 V1 V2
# 1: 0060a00000fUbAnAAK S 2 S 3
# 2: 0060a00000fUbAnAAK S 3 S 4
# 3: 0060a00000fUbAnAAK S 4 S 5
,因为要上传的图像经常会导致H12超时,这意味着用户只需坐下等待直到超时。
我的实现在开发中是成功的,但是在登台过程中,我收到一条错误消息,说Sidekiq节点找不到临时文件。这是因为Sidekiq在单独的节点上运行,并且Heroku不支持将文件上传到其节点,因为它们在重新启动时会被删除。
我现在要做的是让carrierwave_backgrounder
使用Fog作为临时文件存储,并且将该URL传递给Sidekiq worker,而不是将临时缓存的文件上传到Heroku服务器
我对后台任务和异步任务完全陌生。有没有人能够更改carrierwave_backgrounder
宝石来支持Heroku?