From f633966e3c3e0263f92a99dba86b6425e2005db5 Mon Sep 17 00:00:00 2001 From: pengtao Date: Thu, 19 Sep 2019 11:09:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=B9=BF=E5=91=8A=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=89=8D=E5=88=A4=E6=96=AD=E5=86=85=E5=AE=B9=EF=BC=8C?= =?UTF-8?q?=E4=B8=8D=E8=BF=94=E5=9B=9E=E7=8A=B6=E6=80=81=E4=B8=BAnull?= =?UTF-8?q?=E7=9A=84=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad_tasks.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ad_tasks.py b/ad_tasks.py index fd848ea..dca1313 100644 --- a/ad_tasks.py +++ b/ad_tasks.py @@ -170,13 +170,14 @@ def send_cache_data(): id, gameid, channelid, locationids, status = line for locationid in locationids.replace("[", "").replace("]", "").replace('"', "").split(','): area_all = get_area_by_locationid(locationid) - for area in area_all.split(','): - key = f"ad::{gameid}_{locationid}::{channelid}::{area}::{locationid}" - values = f"{id}_{locationid}" - if my_redis.sismember(key, values): - my_redis.srem(key, values) - my_redis.expire(f"adinfo::{values}::info", 1) - log.info(f"remove {id} from {key} success!") + if area_all: + for area in area_all.split(','): + key = f"ad::{gameid}_{locationid}::{channelid}::{area}::{locationid}" + values = f"{id}_{locationid}" + if my_redis.sismember(key, values): + my_redis.srem(key, values) + my_redis.expire(f"adinfo::{values}::info", 1) + log.info(f"remove {id} from {key} success!") except Exception: log.error("拆解过期数据出错!", exc_info=True)