feat(keymgr.py): 热重载后重置超额记录

This commit is contained in:
Rock Chin 2023-01-13 15:34:28 +08:00
parent 36def20a07
commit 9962a6ebcc

View File

@ -39,13 +39,10 @@ class KeysManager:
elif type(api_key) is list:
for i in range(len(api_key)):
self.api_key[str(i)] = api_key[i]
self.auto_switch()
# 从usage中删除未加载的api-key的记录
# 不删了也许会运行时添加曾经有记录的api-key
if 'exceeded_keys' in pkg.utils.context.context and pkg.utils.context.context['exceeded_keys'] is not None:
self.exceeded = pkg.utils.context.context['exceeded_keys']
self.auto_switch()
# 根据tested自动切换到可用的api-key
# 返回是否切换成功, 切换后的api-key的别名