[FA-misc] Reporting service seems to be working

This commit is contained in:
gamer147
2026-02-01 10:19:52 -05:00
parent bdb863a032
commit 9bc39c3abf
6 changed files with 121 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
using FictionArchive.Common.Enums;
using FictionArchive.Service.NovelService.Services;
using FictionArchive.Service.Shared.Contracts.Events;
using FictionArchive.Service.Shared.Extensions;
using MassTransit;
using Microsoft.Extensions.Logging;
@@ -21,6 +23,11 @@ public class ChapterPullRequestedConsumer : IConsumer<IChapterPullRequested>
public async Task Consume(ConsumeContext<IChapterPullRequested> context)
{
var message = context.Message;
var chapterJobId = Guid.NewGuid();
await context.ReportJobStatus(
chapterJobId, "ChapterPull", $"Pull chapter {message.ChapterOrder}",
JobStatus.InProgress, parentJobId: message.ImportId);
var (chapter, imageCount) = await _novelUpdateService.PullChapterContents(
message.ImportId,
@@ -33,5 +40,10 @@ public class ChapterPullRequestedConsumer : IConsumer<IChapterPullRequested>
chapter.Id,
imageCount
));
await context.ReportJobStatus(
chapterJobId, "ChapterPull", $"Pull chapter {message.ChapterOrder}",
JobStatus.Completed, parentJobId: message.ImportId,
metadata: new Dictionary<string, string> { ["ChapterId"] = chapter.Id.ToString() });
}
}