|
|
@@ -216,6 +216,25 @@ class CreateInnerArticlesDecodeTask(DecodeArticleConst):
|
|
|
self.mapper = InnerArticlesDecodeTaskMapper(self.pool)
|
|
|
self.tool = InnerArticlesDecodeUtils()
|
|
|
|
|
|
+ async def deal(self):
|
|
|
+ article_list = await self._acquire_articles()
|
|
|
+ if not article_list:
|
|
|
+ await self.log_service.log(
|
|
|
+ contents={
|
|
|
+ "task": "create_inner_decode_task",
|
|
|
+ "message": "No more articles to decode",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ return
|
|
|
+
|
|
|
+ await self._submit_and_record(article_list)
|
|
|
+ await self.log_service.log(
|
|
|
+ contents={
|
|
|
+ "task": "create_inner_decode_task",
|
|
|
+ "message": f"Processed {len(article_list)} articles",
|
|
|
+ }
|
|
|
+ )
|
|
|
+
|
|
|
async def _acquire_articles(self) -> List[Dict]:
|
|
|
"""获取待解构文章,并加锁(status INIT → PROCESSING)"""
|
|
|
article_list = await self.mapper.fetch_inner_articles()
|
|
|
@@ -386,24 +405,5 @@ class CreateInnerArticlesDecodeTask(DecodeArticleConst):
|
|
|
article_id, self.TaskStatus.PROCESSING, self.TaskStatus.INIT
|
|
|
)
|
|
|
|
|
|
- async def deal(self):
|
|
|
- article_list = await self._acquire_articles()
|
|
|
- if not article_list:
|
|
|
- await self.log_service.log(
|
|
|
- contents={
|
|
|
- "task": "create_inner_decode_task",
|
|
|
- "message": "No more articles to decode",
|
|
|
- }
|
|
|
- )
|
|
|
- return
|
|
|
-
|
|
|
- await self._submit_and_record(article_list)
|
|
|
- await self.log_service.log(
|
|
|
- contents={
|
|
|
- "task": "create_inner_decode_task",
|
|
|
- "message": f"Processed {len(article_list)} articles",
|
|
|
- }
|
|
|
- )
|
|
|
-
|
|
|
|
|
|
__all__ = ["CreateAdPlatformArticlesDecodeTask", "CreateInnerArticlesDecodeTask"]
|