Skip to content

Commit

Permalink
Added health check for web
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaserlang committed Mar 3, 2022
1 parent 0b12824 commit 1e63161
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions tbot/web/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def App():
(r'/(favicon.ico)', web.StaticFileHandler,
{"path": os.path.join(os.path.dirname(__file__), 'static')}),

(r'/health', handlers.health.Handler),
(r'/twitch/login', handlers.api.twitch.oauth.Login_handler),
(r'/twitch/logout', handlers.api.twitch.oauth.Logout_handler),
(r'/connect/twitch', handlers.api.twitch.oauth.Handler),
Expand Down
1 change: 1 addition & 0 deletions tbot/web/handlers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
react,
api,
twitch,
health,
)
12 changes: 12 additions & 0 deletions tbot/web/handlers/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from tornado.web import RequestHandler

class Handler(RequestHandler):

async def get(self):
self.set_header('Content-Type', 'text/plain')
if hasattr(self.application, 'shutting_down') and self.application.shutting_down == True:
self.write('SHUTTING DOWN')
self.set_status(503)
return
self.set_status(200)
self.write('READY')

0 comments on commit 1e63161

Please sign in to comment.