Skip to content

Commit 4373b5c

Browse files
committed
Merge pull request resque#246 from lucasmundim/master
Fix polling from /workers/all in resque-web
2 parents c7a5244 + ae2828a commit 4373b5c

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

lib/resque/server.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,27 @@ def show(page, layout = true)
125125
erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis_id})"
126126
end
127127
end
128+
129+
def show_for_polling(page)
130+
content_type "text/html"
131+
@polling = true
132+
show(page.to_sym, false).gsub(/\s{1,}/, ' ')
133+
end
128134

129135
# to make things easier on ourselves
130136
get "/?" do
131137
redirect url_path(:overview)
132138
end
139+
140+
%w( overview workers ).each do |page|
141+
get "/#{page}.poll" do
142+
show_for_polling(page)
143+
end
144+
145+
get "/#{page}/:id.poll" do
146+
show_for_polling(page)
147+
end
148+
end
133149

134150
%w( overview queues working workers key ).each do |page|
135151
get "/#{page}" do
@@ -146,14 +162,6 @@ def show(page, layout = true)
146162
redirect u('queues')
147163
end
148164

149-
%w( overview workers ).each do |page|
150-
get "/#{page}.poll" do
151-
content_type "text/html"
152-
@polling = true
153-
show(page.to_sym, false).gsub(/\s{1,}/, ' ')
154-
end
155-
end
156-
157165
get "/failed" do
158166
if Resque::Failure.url
159167
redirect Resque::Failure.url

0 commit comments

Comments
 (0)