Skip to content

Commit

Permalink
Merge branch 'defunkt' into distributed
Browse files Browse the repository at this point in the history
  • Loading branch information
mpd committed Jul 26, 2011
2 parents 9016204 + ca4f63d commit b8549ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions examples/monit/resque.monit
@@ -1,6 +1,6 @@
check process resque_worker_QUEUE
with pidfile /data/APP_NAME/current/tmp/pids/resque_worker_QUEUE.pid
start program = "/bin/sh -l -c 'cd /data/APP_NAME/current; nohup bundle exec rake environment resque:work RAILS_ENV=production QUEUE=queue_name VERBOSE=1 PIDFILE=tmp/pids/resque_worker_QUEUE.pid & >> log/resque_worker_QUEUE.log 2>&1'" as uid deploy and gid deploy
stop program = "/bin/sh -c 'cd /data/APP_NAME/current && kill -s QUIT `cat tmp/pids/resque_worker_QUEUE.pid` && rm -f tmp/pids/resque_worker_QUEUE.pid; exit 0;'"
start program = "/usr/bin/env HOME=/home/user RACK_ENV=production PATH=/usr/local/bin:/usr/local/ruby/bin:/usr/bin:/bin:$PATH /bin/sh -l -c 'cd /data/APP_NAME/current; nohup bundle exec rake environment resque:work RAILS_ENV=production QUEUE=queue_name VERBOSE=1 PIDFILE=tmp/pids/resque_worker_QUEUE.pid & >> log/resque_worker_QUEUE.log 2>&1'" as uid deploy and gid deploy
stop program = "/bin/sh -c 'cd /data/APP_NAME/current && kill -9 %(cat tmp/pids/resque_worker_QUEUE.pid) && rm -f tmp/pids/resque_worker_QUEUE.pid; exit 0;'"
if totalmem is greater than 300 MB for 10 cycles then restart # eating up memory?
group resque_workers
group resque_workers
7 changes: 4 additions & 3 deletions lib/resque/server.rb
Expand Up @@ -119,13 +119,14 @@ def poll
end

def show(page, layout = true)
response["Cache-Control"] = "max-age=0, private, must-revalidate"
begin
erb page.to_sym, {:layout => layout}, :resque => Resque
rescue Errno::ECONNREFUSED
erb :error, {:layout => false}, :error => "Can't connect to Redis! (#{Resque.redis_id})"
end
end

def show_for_polling(page)
content_type "text/html"
@polling = true
Expand All @@ -136,12 +137,12 @@ def show_for_polling(page)
get "/?" do
redirect url_path(:overview)
end

%w( overview workers ).each do |page|
get "/#{page}.poll" do
show_for_polling(page)
end

get "/#{page}/:id.poll" do
show_for_polling(page)
end
Expand Down

0 comments on commit b8549ed

Please sign in to comment.