♻️ Move the web reader from Sphere to Insight (w.i.p)

This commit is contained in:
2026-01-02 00:15:56 +08:00
parent c4b2b2f61f
commit ede49333f8
18 changed files with 59 additions and 64 deletions

View File

@@ -0,0 +1,35 @@
using DysonNetwork.Shared.Models;
using Microsoft.EntityFrameworkCore;
using Quartz;
namespace DysonNetwork.Insight.Reader;
[DisallowConcurrentExecution]
public class WebFeedScraperJob(
AppDatabase database,
WebFeedService webFeedService,
ILogger<WebFeedScraperJob> logger
)
: IJob
{
public async Task Execute(IJobExecutionContext context)
{
logger.LogInformation("Starting web feed scraper job.");
var feeds = await database.Set<SnWebFeed>().ToListAsync(context.CancellationToken);
foreach (var feed in feeds)
{
try
{
await webFeedService.ScrapeFeedAsync(feed, context.CancellationToken);
}
catch (Exception ex)
{
logger.LogError(ex, "Failed to scrape web feed {FeedId}", feed.Id);
}
}
logger.LogInformation("Web feed scraper job finished.");
}
}