dongzhaorui 3 年之前
父节点
当前提交
974d9fc9df
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      find_source/crawler/q.py

+ 6 - 6
find_source/crawler/q.py

@@ -27,14 +27,14 @@ class RedisQueue:
         keys = sorted(keys, key=lambda x: x.split('-')[-1], reverse=True)
         return keys
 
-    def push_task(self, key, tasks, level=1, allow_output_log=False):
+    def push_task(self, key, tasks, level=1, disable_debug_log=True):
         """
         双端队列,左边推进任务
 
         :param key: 键名称
         :param tasks: 任务列表
         :param level: 优先级(int类型),数值越大优先级越高,默认1
-        :param allow_output_log: 允许输出日志
+        :param disable_debug_log: 调试日志
         :return: 任务队列任务数量
         """
         # 重新定义优先队列的key
@@ -42,7 +42,7 @@ class RedisQueue:
 
         # 序列化任务参数
         tasks = [json.dumps(t, default=lambda obj: obj.__dict__['data']) for t in tasks]
-        if allow_output_log:
+        if not disable_debug_log:
             logger.debug(f'RedisQueue info > the number of push tasks: {len(tasks)}')
 
         if not tasks:
@@ -82,17 +82,17 @@ class RedisQueue:
                     pass
             return results
 
-    def push_task_by_key(self, key, tasks, allow_output_log=False):
+    def push_task_by_key(self, key, tasks, disable_debug_log=True):
         """
         通过键名称从左边推进任务
 
         :param key: 键名称
         :param tasks: 推送的任务
-        :param allow_output_log: 允许输出日志
+        :param disable_debug_log: 调试日志
         :return:
         """
         tasks = [json.dumps(t, default=lambda obj: obj.__dict__['data']) for t in tasks]
-        if allow_output_log:
+        if not disable_debug_log:
             logger.debug(f'RedisQueue info > the number of push tasks: {len(tasks)}')
         if not tasks:
             return self.redis.llen(key)