我有一个队列,它处理一些通过 JSON 发送的“产品”。我以 {1, 2, 3, 4} 之类的顺序接收它们,但 resque 在 {1, 3, 2, 4} 中处理它们。他们订购的resque过程非常重要,因为旧版本Product
可以覆盖已经处理过的新版本
有没有办法告诉resque process {job} orderede by {job.field_I_want}
?
编辑:排队工作的代码
def produto
if params[:json]
# upload = params[:json]
# content = upload.read
# parsed_json = JSON(content)
parsed_json = JSON(params[:json])
parsed_json['idFila'] = params[:idFila]
logger.info parsed_json
Resque.enqueue(ProdutoWorker, parsed_json)
render json: ActiveSupport::JSON.encode(Retorno.new(:status => "OK", :mensagem => "Produto recebido")), :status => :ok
else
render json: ActiveSupport::JSON.encode(Retorno.new(:status => "Erro", :mensagem => "Sem JSON")), :status => :not_found
end
rescue => exception
render json: ActiveSupport::JSON.encode(Retorno.new(:status => "Erro", :mensagem => "#{exception}")), :status => :error
end #Produto