This commit is contained in:
dongchangxi committed 2025-11-24 17:52:58 +08:00
1 parent a555102862
commit 1900f1acd5
1 file changed
+2 -2
@@ -99,12 +99,12 @@ def main():
while True: while True:
r = redisClient() r = redisClient()
#检测队列是否有值 #检测队列是否有值
if r.llen('pb:sliceing') == 0: if r.scard('pb:sliceing') == 0:
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 队列为空,等待10秒') print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 队列为空,等待10秒')
time.sleep(10) time.sleep(10)
continue continue
#获取队列中的值 #获取队列中的值
data = r.lpop('pb:sliceing') data = r.spop('pb:sliceing')
if data is None: if data is None:
print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 取出的数据为空,等待10秒') print(f'{time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())} 取出的数据为空,等待10秒')
time.sleep(10) time.sleep(10)