未验证 提交 6f8c255a 编写于 作者: 走神的阿圆's avatar 走神的阿圆 提交者: GitHub

Add ProtoUpdater (#631)

上级 e64a3bca
......@@ -154,7 +154,7 @@ def gen_result(status, msg, data):
return result
def create_app(args, method):
def create_app(args):
app = Flask(__name__, static_url_path="")
# set static expires in a short time to reduce browser's memory usage.
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 30
......@@ -166,7 +166,7 @@ def create_app(args, method):
# use a memory cache to reduce disk reading frequency.
CACHE = MemCache(timeout=args.cache_timeout)
cache_get = lib.cache_get(CACHE)
update_util.PbUpdater(method).start()
update_util.PbUpdater().start()
public_path = args.public_path.rstrip('/')
api_path = public_path + '/api'
......@@ -350,7 +350,7 @@ def _run(logdir,
language=language,
public_path=public_path)
logger.info(" port=" + str(args.port))
app = create_app(args, 'run')
app = create_app(args)
index_url = "http://" + host + ":" + str(port) + args.public_path
if open_browser:
threading.Thread(
......@@ -401,7 +401,7 @@ def main():
for sig in [signal.SIGINT, signal.SIGHUP, signal.SIGTERM]:
signal.signal(sig, clean_template)
logger.info(" port=" + str(args.port))
app = create_app(args, 'main')
app = create_app(args)
app.run(debug=False, host=args.host, port=args.port, threaded=False)
......
......@@ -29,18 +29,15 @@ def md5(text):
class PbUpdater(threading.Thread):
def __init__(self, start_method):
def __init__(self):
threading.Thread.__init__(self)
self.start_method = start_method
def update_pb(self,
start_method,
version=__version__,
md5_code=md5(str(DESCRIPTOR))
):
payload = {
"data": {
"start_method": start_method,
"version": version,
"md5": md5_code
}
......@@ -57,7 +54,6 @@ class PbUpdater(threading.Thread):
pass
def run(self):
self.update_pb(start_method=self.start_method,
version=__version__,
self.update_pb(version=__version__,
md5_code=md5(str(DESCRIPTOR))
)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册