diff --git a/r2/r2/controllers/health.py b/r2/r2/controllers/health.py index 3e60373b4..7acb0a18d 100644 --- a/r2/r2/controllers/health.py +++ b/r2/r2/controllers/health.py @@ -20,60 +20,15 @@ class HealthController(MinimalController): def pre(self): pass - def shutdown(self): - thread_pool = c.thread_pool - def _shutdown(): - #give busy threads 30 seconds to finish up - for s in xrange(30): - busy = thread_pool.track_threads()['busy'] - if not busy: - break - time.sleep(1) - - thread_pool.shutdown() - worker.join() - os._exit(3) - - t = Thread(target = _shutdown) - t.setDaemon(True) - t.start() - def GET_health(self): c.dontcache = True if g.shutdown: - if g.shutdown == 'init': - self.shutdown() - g.shutdown = 'shutdown' abort(503, 'service temporarily unavailable') else: response.headers['Content-Type'] = 'text/plain' return "i'm still alive!" - @validate(secret=nop('secret')) - def GET_threads(self, secret): - if not g.shutdown_secret: - self.abort404() - if not secret or secret != g.shutdown_secret: - self.abort403() - - c.dontcache = True - - if g.shutdown: - c.response.content = "not bothering to check, due to shutdown" - else: - thread_pool = c.thread_pool - tt = thread_pool.track_threads() - s = '' - for k in ('idle', 'busy', 'hung', 'dying', 'zombie'): - s += "%s=%s " % (k, len(tt[k])) - - s += "\n" - c.response.content = s - - response.headers['Content-Type'] = 'text/plain' - return c.response - @validate(secret=nop('secret')) def GET_sleep(self, secret): if not g.shutdown_secret: diff --git a/r2/r2/lib/base.py b/r2/r2/lib/base.py index 70b8784ec..5166bd3a3 100644 --- a/r2/r2/lib/base.py +++ b/r2/r2/lib/base.py @@ -96,8 +96,6 @@ class BaseController(WSGIController): request.environ['pylons.routes_dict']['action'] = \ meth + '_' + action - c.thread_pool = environ['paste.httpserver.thread_pool'] - c.response = Response() try: res = WSGIController.__call__(self, environ, start_response)