1
0
Fork 0
mirror of https://github.com/endofunky/sidetiq.git synced 2022-11-09 13:53:30 -05:00

Don't crash when using KEYS in sidetiq/web.

This commit is contained in:
Connor Dunn 2014-06-10 17:09:41 -07:00
parent 88b32c79cd
commit 2556541d23
2 changed files with 10 additions and 2 deletions

View file

@ -13,6 +13,7 @@
<%= erb File.read(File.join(view_path, '_home_nav.erb')) %>
<div class="col-md-9">
<% if @locks_available %>
<% if @locks.length > 0 %>
<table class="table table-striped table-bordered table-white table-sidetiq">
<thead>
@ -44,7 +45,9 @@
<% else %>
<div class="alert alert-success">No locks set.</div>
<% end %>
</div>
<% else %>
<div class="alert alert-danger">KEYS command is disabled in your redis instance, lock information is not available.</div>
<% end %>
</div>
</div>

View file

@ -13,7 +13,12 @@ module Sidetiq
end
app.get "/sidetiq/locks" do
@locks = Sidetiq::Lock::Redis.all.map(&:meta_data)
begin
@locks = Sidetiq::Lock::Redis.all.map(&:meta_data)
@locks_available = true
rescue Redis::CommandError
@locks_available = false
end
erb File.read(File.join(VIEWS, 'locks.erb')), locals: {view_path: VIEWS}
end