🐛 Fix TypeError exception caused by data is None

This commit is contained in:
洛水居室 2023-03-18 22:15:07 +08:00
parent 1f1734ca03
commit a2c2087162
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -116,6 +116,9 @@ class CharacterDetails(Plugin):
logger.warning("非法Key %s", key) logger.warning("非法Key %s", key)
continue continue
data = await self.redis.get(key) data = await self.redis.get(key)
if data is None:
logger.warning("Redis key[%s] 数据未找到", key) # 如果未找到可能因为处理过程中已经过期,导致该数据未回写到 MySQL
continue
str_data = str(data, encoding="utf-8") str_data = str(data, encoding="utf-8")
async with AsyncSession(self.mysql.engine) as session: async with AsyncSession(self.mysql.engine) as session:
statement = ( statement = (