From b6b59a5db39e042d0d173604497ebfa34be47d72 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期三, 11 十月 2023 16:11:45 +0800 Subject: [PATCH] bug修复 --- code_attribute/code_volumn_manager.py | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/code_attribute/code_volumn_manager.py b/code_attribute/code_volumn_manager.py index 35295fd..dc14f4d 100644 --- a/code_attribute/code_volumn_manager.py +++ b/code_attribute/code_volumn_manager.py @@ -7,11 +7,12 @@ # yesterday 鏄ㄥぉ鐨勯噺 import json -from db.redis_manager import RedisUtils +from db.redis_manager_delegate import RedisUtils from utils import global_util, tool -from db import redis_manager +from db import redis_manager_delegate as redis_manager from log_module.log import logger_day_volumn +__db = 0 __redis_manager = redis_manager.RedisManager(0) @@ -21,9 +22,9 @@ global_util.max60_volumn[code] = (max60, max60_day) global_util.yesterday_volumn[code] = yesterday try: - RedisUtils.setex(redis, "volumn_max60-{}".format(code), tool.get_expire(), json.dumps((max60, max60_day)), - auto_free=False) - RedisUtils.setex(redis, "volumn_yes-{}".format(code), tool.get_expire(), yesterday, auto_free=False) + RedisUtils.setex_async(0, "volumn_max60-{}".format(code), tool.get_expire(), json.dumps((max60, max60_day)), + auto_free=False) + RedisUtils.setex_async(0, "volumn_yes-{}".format(code), tool.get_expire(), yesterday, auto_free=False) finally: RedisUtils.realse(redis) @@ -63,7 +64,6 @@ # datas:[(code, volumn)] def set_today_volumns(datas): - pipe = __redis_manager.getRedis().pipeline() for d in datas: code, volumn = d logger_day_volumn.info("code:{} volumn:{}".format(code, volumn)) @@ -72,8 +72,7 @@ if code in __today_volumn_cache and volumn - __today_volumn_cache[code] < 100000: continue __today_volumn_cache[code] = volumn - RedisUtils.setex(pipe, "volumn_today-{}".format(code), tool.get_expire(), volumn) - pipe.execute() + RedisUtils.setex_async(__db, "volumn_today-{}".format(code), tool.get_expire(), volumn) # 鑾峰彇浠婃棩閲� -- Gitblit v1.8.0