Browse Source

修正清理缓存时名称不存在抛出的错误

dongzhaorui 1 year ago
parent
commit
942f45b955
1 changed files with 2 additions and 2 deletions
  1. 2 2
      FworkSpider/feapder/db/rabbitMq.py

+ 2 - 2
FworkSpider/feapder/db/rabbitMq.py

@@ -168,8 +168,8 @@ class RabbitMQ:
                 if isinstance(binding_key, tuple):
                     queue, exchange, routing_key = binding_key
                     # 清除缓存
-                    del self.__cache[queue]
-                    del self.__cache[binding_key]
+                    self.__cache.pop(queue, None)
+                    self.__cache.pop(binding_key, None)
                     # 重新声明
                     self.declare(queue, exchange, routing_key)
         except Exception as e: