2016-06-02 20:33:39 +00:00
|
|
|
import json
|
2016-10-02 20:48:14 +00:00
|
|
|
|
2016-12-28 11:41:24 +00:00
|
|
|
import tornado.web
|
|
|
|
import tornado.gen
|
|
|
|
|
|
|
|
from common.sentry import sentry
|
2016-10-02 20:48:14 +00:00
|
|
|
from common.web import requestsManager
|
2016-06-02 20:33:39 +00:00
|
|
|
from objects import glob
|
|
|
|
|
2016-10-02 20:48:14 +00:00
|
|
|
|
|
|
|
class handler(requestsManager.asyncRequestHandler):
|
2016-12-28 11:41:24 +00:00
|
|
|
@tornado.web.asynchronous
|
|
|
|
@tornado.gen.engine
|
|
|
|
@sentry.captureTornado
|
2016-06-02 20:33:39 +00:00
|
|
|
def asyncGet(self):
|
|
|
|
statusCode = 400
|
|
|
|
data = {"message": "unknown error"}
|
|
|
|
try:
|
|
|
|
# Get online users count
|
|
|
|
data["result"] = -1 if glob.restarting == True else 1
|
|
|
|
|
|
|
|
# Status code and message
|
|
|
|
statusCode = 200
|
|
|
|
data["message"] = "ok"
|
|
|
|
finally:
|
|
|
|
# Add status code to data
|
|
|
|
data["status"] = statusCode
|
|
|
|
|
|
|
|
# Send response
|
2016-06-18 08:23:07 +00:00
|
|
|
self.write(json.dumps(data))
|
2016-06-02 20:33:39 +00:00
|
|
|
self.set_status(statusCode)
|