请求模式转为异步

This commit is contained in:
pengtao 2019-07-19 10:07:17 +08:00
parent 75b884d1c1
commit 7e23607511
2 changed files with 155 additions and 152 deletions

View File

@ -36,8 +36,9 @@ def send_cache_data():
log.info(f"line was {line}")
item = {}
try:
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item['appid'] = line
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
'ad_url'], item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item[
'appid'] = line
all.append(item)
except Exception:
log.error("split data failed", exc_info=True)
@ -51,8 +52,9 @@ def send_cache_data():
if line:
item = {}
try:
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item['ad_url'], \
item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item['appid'] = line
item['id'], item['name'], item['ad_num'], item['ad_title'], item['ad_body'], item['ad_image'], item[
'ad_url'], item['ad_sort'], item['companyid'], item['locationid'], item['gameid'], item[
'appid'] = line
all.append(item)
except Exception:
log.error("split data failed", exc_info=True)
@ -104,7 +106,7 @@ def send_cache_data():
class DispatchHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
if self.get_query_argument('c') == 'Ops' and self.get_query_argument('a') == 'selfChecking':
self._selfCheckingHandler()
@ -114,6 +116,7 @@ class DispatchHandler(tornado.web.RequestHandler):
self._upAdRecording()
else:
self.write("pls check args!")
self.finish()
def _upAdRecording(self):
try: