[FA-misc] Reporting service seems to be working
This commit is contained in:
@@ -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() });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user