mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Web UI bug fixes, 0.9.1 [fixes #81]
This commit is contained in:
parent
727c5af21b
commit
18a458bf1f
7 changed files with 27 additions and 10 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
0.9.1
|
||||||
|
-----------
|
||||||
|
|
||||||
|
- Fix missed deprecations, poor method name in web UI
|
||||||
|
|
||||||
0.9.0
|
0.9.0
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ require 'sidekiq/client'
|
||||||
require 'sidekiq/worker'
|
require 'sidekiq/worker'
|
||||||
require 'sidekiq/rails'
|
require 'sidekiq/rails'
|
||||||
require 'sidekiq/redis_connection'
|
require 'sidekiq/redis_connection'
|
||||||
|
require 'sidekiq/util'
|
||||||
|
|
||||||
require 'sidekiq/extensions/action_mailer'
|
require 'sidekiq/extensions/action_mailer'
|
||||||
require 'sidekiq/extensions/active_record'
|
require 'sidekiq/extensions/active_record'
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module Sidekiq
|
module Sidekiq
|
||||||
VERSION = "0.9.0"
|
VERSION = "0.9.1"
|
||||||
end
|
end
|
||||||
|
|
|
@ -38,7 +38,7 @@ module Sidekiq
|
||||||
helpers do
|
helpers do
|
||||||
def workers
|
def workers
|
||||||
@workers ||= begin
|
@workers ||= begin
|
||||||
Sidekiq.redis.with_connection do |conn|
|
Sidekiq.redis do |conn|
|
||||||
conn.smembers('workers').map do |w|
|
conn.smembers('workers').map do |w|
|
||||||
msg = conn.get("worker:#{w}")
|
msg = conn.get("worker:#{w}")
|
||||||
msg = MultiJson.decode(msg) if msg
|
msg = MultiJson.decode(msg) if msg
|
||||||
|
@ -49,15 +49,15 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def processed
|
def processed
|
||||||
Sidekiq.redis.get('stat:processed') || 0
|
Sidekiq.redis { |conn| conn.get('stat:processed') } || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def failed
|
def failed
|
||||||
Sidekiq.redis.get('stat:failed') || 0
|
Sidekiq.redis { |conn| conn.get('stat:failed') } || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def queues
|
def queues
|
||||||
Sidekiq.redis.with_connection do |conn|
|
Sidekiq.redis do |conn|
|
||||||
conn.smembers('queues').map do |q|
|
conn.smembers('queues').map do |q|
|
||||||
[q, conn.llen("queue:#{q}") || 0]
|
[q, conn.llen("queue:#{q}") || 0]
|
||||||
end.sort { |x,y| x[1] <=> y[1] }
|
end.sort { |x,y| x[1] <=> y[1] }
|
||||||
|
@ -65,14 +65,14 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
def location
|
def location
|
||||||
Sidekiq.redis.client.location
|
Sidekiq.redis { |conn| conn.client.location }
|
||||||
end
|
end
|
||||||
|
|
||||||
def root_path
|
def root_path
|
||||||
"#{env['SCRIPT_NAME']}/"
|
"#{env['SCRIPT_NAME']}/"
|
||||||
end
|
end
|
||||||
|
|
||||||
def status
|
def current_status
|
||||||
return 'down' if workers.size == 0
|
return 'down' if workers.size == 0
|
||||||
return 'idle' if workers.size > 0 && workers.map { |x| x[1] }.compact.size == 0
|
return 'idle' if workers.size > 0 && workers.map { |x| x[1] }.compact.size == 0
|
||||||
return 'active'
|
return 'active'
|
||||||
|
@ -84,8 +84,9 @@ module Sidekiq
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/queues/:name" do
|
get "/queues/:name" do
|
||||||
|
halt 404 unless params[:name]
|
||||||
@name = params[:name]
|
@name = params[:name]
|
||||||
@messages = Sidekiq.redis.lrange("queue:#{@name}", 0, 10).map { |str| MultiJson.decode(str) }
|
@messages = Sidekiq.redis {|conn| conn.lrange("queue:#{@name}", 0, 10) }.map { |str| MultiJson.decode(str) }
|
||||||
slim :queue
|
slim :queue
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
PATH
|
PATH
|
||||||
remote: ..
|
remote: ..
|
||||||
specs:
|
specs:
|
||||||
sidekiq (0.9.0)
|
sidekiq (0.9.1)
|
||||||
celluloid
|
celluloid
|
||||||
connection_pool (>= 0.9.0)
|
connection_pool (>= 0.9.0)
|
||||||
multi_json
|
multi_json
|
||||||
|
|
|
@ -47,5 +47,15 @@ class TestWeb < MiniTest::Unit::TestCase
|
||||||
assert_match last_response.body, /foo/
|
assert_match last_response.body, /foo/
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'handles queues with no name' do
|
||||||
|
get '/queues'
|
||||||
|
assert_equal 404, last_response.status
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'handles queue view' do
|
||||||
|
get '/queues/default'
|
||||||
|
assert_equal 200, last_response.status
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
.hero-unit
|
.hero-unit
|
||||||
h1 Sidekiq is #{status}
|
h1 Sidekiq is #{current_status}
|
||||||
p Processed: #{processed}
|
p Processed: #{processed}
|
||||||
p Failed: #{failed}
|
p Failed: #{failed}
|
||||||
p Workers: #{workers.size}
|
p Workers: #{workers.size}
|
||||||
|
|
Loading…
Reference in a new issue