请求模式转为异步

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:

View File

@ -2,10 +2,10 @@
redis_company_config = {'host': '192.168.100.20', 'port': 6379, 'db': 1}
expire_time = 7200
mysql_promotion_config = {'user': 'miles', 'pswd': 'aspect', 'host': '192.168.100.30', 'db': 'test'}
ad_list_interface_port=5555
ad_list_interface_port = 5555
BEGIN = '1999-01-01'
END = '3000-01-01'
#mysql_promotion_config = {'user': 'mytga', 'pswd': 'gzVwh4HGR68G', 'host': '10.10.3.5', 'db': 'games_report'}
#redis_company_config = {'host': '10.10.3.10', 'port': 6379, 'db': 2}
# mysql_promotion_config = {'user': 'mytga', 'pswd': 'gzVwh4HGR68G', 'host': '10.10.3.5', 'db': 'games_report'}
# redis_company_config = {'host': '10.10.3.10', 'port': 6379, 'db': 2}