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

Merge branch 'Connorhd-dont-use-redis-keys'

This commit is contained in:
Tobias Svensson 2014-09-22 12:33:09 +01:00
commit f63f6df8ca
3 changed files with 12 additions and 3 deletions

View file

@ -54,8 +54,9 @@ module Sidetiq
end end
private private
def get_schedulable_keys def get_schedulable_keys
Sidekiq.redis_pool.with { |r| r.keys("sidetiq:#{name}:*") } %w(next last schedule_description history).map { |key| "sidetiq:#{name}:#{key}" }
end end
def get_schedulable_key(key) def get_schedulable_key(key)

View file

@ -13,6 +13,7 @@
<%= erb File.read(File.join(view_path, '_home_nav.erb')) %> <%= erb File.read(File.join(view_path, '_home_nav.erb')) %>
<div class="col-md-9"> <div class="col-md-9">
<% if @locks_available %>
<% if @locks.length > 0 %> <% if @locks.length > 0 %>
<table class="table table-striped table-bordered table-white table-sidetiq"> <table class="table table-striped table-bordered table-white table-sidetiq">
<thead> <thead>
@ -44,7 +45,9 @@
<% else %> <% else %>
<div class="alert alert-success">No locks set.</div> <div class="alert alert-success">No locks set.</div>
<% end %> <% 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>
</div> </div>

View file

@ -13,7 +13,12 @@ module Sidetiq
end end
app.get "/sidetiq/locks" do 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} erb File.read(File.join(VIEWS, 'locks.erb')), locals: {view_path: VIEWS}
end end