簡體   English   中英

無法在rails中將sidekiq隊列設置為“默認”

[英]cannot set sidekiq queue to 'default' in rails

這就是我的NoteWorker中具有rake任務啟動的內容。

NoteWorker.rb

class NoteWorker

  include Sidekiq::Worker

  sidekiq_options queue: "note"
  sidekiq_options :failures => true

  def perform(model_id)
    #do something
  end
end

筆記

namespace :notes do

  task :send_note => :environment do
    NoteWorker.perform_async(model.id)
  end
end

一切正常。 但是我正在嘗試自動縮放,這似乎無法自動縮放多個工作程序,因此我試圖將所有隊列更改為“默認”,而不是自定義名稱。 但是,當我刪除sidekiq_options queue: "note"或將其更改為sidekiq_options queue: "default"時,出現以下錯誤:

"Scaling worker to 1"
rake aborted!
Expected(200) <=> Actual(404 Not Found)
 request => {:connect_timeout=>60, :headers=>{"Accept"=>"application/json", "Accept-Encoding"=>"gzip", "Authorization"=>"Basic Og==", "User-Agent"=>"heroku-rb/0.2.1", "X-Heroku-API-Version"=>"3", "X-Ruby-Version"=>"1.9.3", "X-Ruby-Platform"=>"x86_64-darwin10.8.0", "Host"=>"api.heroku.com:443", "Content-Length"=>0}, :instrumentor_name=>"excon", :mock=>false, :read_timeout=>60, :retry_limit=>4, :ssl_ca_file=>"/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/excon-0.13.4/data/cacert.pem", :ssl_verify_peer=>true, :write_timeout=>60, :host=>"api.heroku.com", :path=>"/apps//ps/scale", :port=>"443", :query=>{"type"=>"worker", "qty"=>1}, :scheme=>"https", :expects=>200, :method=>:post}
response => #<Excon::Response:0x00000104700aa8 @body="{\"id\":\"not_found\",\"error\":\"Not found\"}", @headers={"Cache-Control"=>"no-transform", "Content-Type"=>"application/json;charset=utf-8", "Date"=>"Wed, 31 Jul 2013 02:32:25 GMT", "Status"=>"404 Not Found", "Strict-Transport-Security"=>"max-age=31536000", "X-Cascade"=>"pass", "X-Content-Type-Options"=>"nosniff", "X-Runtime"=>"0.00246243", "Content-Length"=>"38", "Connection"=>"keep-alive"}, @status=404>
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/excon-0.13.4/lib/excon/connection.rb:266:in `request_kernel'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/excon-0.13.4/lib/excon/connection.rb:97:in `request'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/heroku-api-0.2.1/lib/heroku/api.rb:60:in `request'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/heroku-api-0.2.1/lib/heroku/api/processes.rb:43:in `post_ps_scale'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/autoscaler-0.3.0/lib/autoscaler/heroku_scaler.rb:38:in `workers='
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/autoscaler-0.3.0/lib/autoscaler/sidekiq/client.rb:14:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/middleware/chain.rb:111:in `block in invoke'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/middleware/chain.rb:114:in `call'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/middleware/chain.rb:114:in `invoke'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/client.rb:112:in `process_single'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/client.rb:40:in `push'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/worker.rb:68:in `client_push'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/sidekiq-2.8.0/lib/sidekiq/worker.rb:38:in `perform_async'
/Users/user/rails_projects/notebook/lib/tasks/send_note.rake:25:in `block (3 levels) in <top (required)>'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/activerecord-3.2.12/lib/active_record/relation/delegation.rb:6:in `each'
/Users/user/.rvm/gems/ruby-1.9.3-p0@notebook/gems/activerecord-3.2.12/lib/active_record/relation/delegation.rb:6:in `each'
/Users/user/rails_projects/notebook/lib/tasks/send_note.rake:24:in `block (2 levels) in <top (required)>'
Tasks: TOP => send_note:send_note
(See full trace by running task with --trace)

答案在這里 JustinLove實際上創建了一個示例文件,他在鏈中鏈接了該文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM