From fb47d36048e94b9a506d5c153e3dd19a01e37df1 Mon Sep 17 00:00:00 2001 From: Administrator <admin@example.com> Date: 星期一, 30 十月 2023 16:30:27 +0800 Subject: [PATCH] bug修复 --- code_attribute/gpcode_manager.py | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-) diff --git a/code_attribute/gpcode_manager.py b/code_attribute/gpcode_manager.py index 3ddc680..86ddbee 100644 --- a/code_attribute/gpcode_manager.py +++ b/code_attribute/gpcode_manager.py @@ -2,6 +2,7 @@ 鑲$エ浠g爜绠$悊鍣� """ import json +import random import time import constant @@ -13,6 +14,7 @@ from ths import l2_listen_pos_health_manager, client_manager __redisManager = redis_manager.RedisManager(0) +__db = 0 class CodesNameManager: @@ -173,11 +175,11 @@ hasChanged = False for code in codes: if code not in self.__first_code_limited_up_record_cache: - RedisUtils.sadd_async(self.__get_redis(), "first_code_limited_up_record", code) + RedisUtils.sadd_async(self.__db, "first_code_limited_up_record", code) hasChanged = True self.__first_code_limited_up_record_cache.add(code) if hasChanged: - RedisUtils.expire_async(self.__get_redis(), "first_code_limited_up_record", tool.get_expire()) + RedisUtils.expire_async(self.__db, "first_code_limited_up_record", tool.get_expire()) # 鏄惁娑ㄥ仠杩� def is_limited_up(self, code): @@ -510,7 +512,8 @@ def is_in_gp_pool(code): - return RedisUtils.sismember(__redisManager.getRedis(), "gp_list", code) or FirstGPCodesManager().is_in_first_gp_codes_cache(code) + return RedisUtils.sismember(__redisManager.getRedis(), "gp_list", + code) or FirstGPCodesManager().is_in_first_gp_codes_cache(code) def get_gp_list(): @@ -585,6 +588,14 @@ return limit_up_price +def get_limit_up_price_cache(code): + if code in __limit_up_price_dict: + return __limit_up_price_dict[code] + + + return None + + def get_limit_up_price_by_preprice(price): if price is None: return None @@ -620,14 +631,12 @@ # datas:[(code,price)] def set_prices(datas): - pipe = __redisManager.getRedis().pipeline() for d in datas: code, price = d[0], d[1] if code in __current_price_cache and __current_price_cache[code] == price: continue __current_price_cache[code] = price - RedisUtils.setex(pipe, "price-{}".format(code), tool.get_expire(), price) - pipe.execute() + RedisUtils.setex_async(__db, "price-{}".format(code), tool.get_expire(), price) # 鑾峰彇姝e湪鐩戝惉鐨勪唬鐮� -- Gitblit v1.8.0