feat: 添加爬虫状态更新中的显示支持
在爬虫状态列中增加"正在更新"状态显示,并在爬虫过程中更新状态
This commit is contained in:
@@ -49,7 +49,17 @@ export class CrawlerController {
|
||||
this.crawlingSources.add(sourceName);
|
||||
|
||||
try {
|
||||
// 设置状态为正在更新(count = -1)
|
||||
await this.crawlerService.updateCrawlStatus(sourceName, -1);
|
||||
|
||||
const result = await this.crawlerService.crawlSingleSource(sourceName);
|
||||
|
||||
// 更新状态为实际数量
|
||||
await this.crawlerService.updateCrawlStatus(
|
||||
sourceName,
|
||||
result.success ? result.count : 0,
|
||||
);
|
||||
|
||||
return result;
|
||||
} finally {
|
||||
this.crawlingSources.delete(sourceName);
|
||||
|
||||
Reference in New Issue
Block a user