Browse Source

limit.py 增加阿里云日志
xiaoniangao_author_v2.py 增加阿里云日志

罗俊辉 1 year ago
parent
commit
2c54b7393e
2 changed files with 20 additions and 2 deletions
  1. 10 2
      common/limit.py
  2. 10 0
      xiaoniangao/xiaoniangao_author/xiaoniangao_author_v2.py

+ 10 - 2
common/limit.py

@@ -95,8 +95,16 @@ class AuthorLimit(object):
         if self.mode == "author":
             tag = self.find_tag(user_id)
             if tag:
-                if RedisClient().connect():
-                    tag_count = RedisClient().select(tag)
+                AliyunLogger.logging(
+                    code="8807",
+                    platform=self.platform,
+                    mode=self.mode,
+                    env="prod",
+                    message="找到个人账号,{}".format(tag)
+                )
+                R = RedisClient()
+                if R.connect():
+                    tag_count = R.select(tag)
                     if tag_count:
                         tag_count = int(tag_count.decode("utf-8"))
                         if tag_count <= 300:

+ 10 - 0
xiaoniangao/xiaoniangao_author/xiaoniangao_author_v2.py

@@ -316,4 +316,14 @@ class XiaoNianGaoAuthor:
                     env=self.env,
                     message="成功发送 MQ 至 ETL",
                 )
+            else:
+                AliyunLogger.logging(
+                    code="8808",
+                    platform=self.platform,
+                    mode=self.mode,
+                    env=self.env,
+                    trace_id=trace_id,
+                    account=video_dict['user_id'],
+                    message="监测到个人账号数量超过 300,停止抓取该账号"
+                )
         return True