More work

This commit is contained in:
Nickk888 committed 2026-10-12 01:14:13 +02:00
1 parent c06f06c6ce
commit 8b476e6939
20 files changed
+871 -22

No files matched your search

+8 -7
View File
@@ -1,8 +1,6 @@
using System;
using System.Collections.Frozen;
using Microsoft.EntityFrameworkCore;
using PaperlessAI.Context;
using PaperlessAI.Repositories;
using PaperlessAI.Models;
using PaperlessAI.Services;
namespace PaperlessAI.Jobs;
@@ -11,7 +9,10 @@ public class CheckDocumentsToProcessJob(ILogger<CheckDocumentsToProcessJob> logg
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(5));
await using var scope = scopeFactory.CreateAsyncScope();
var config = scope.ServiceProvider.GetRequiredService<Configuration>();
using var timer = new PeriodicTimer(TimeSpan.FromSeconds(config.CheckDocumentsToProcessJobPeriodSeconds));
do
{
@@ -30,11 +31,11 @@ public class CheckDocumentsToProcessJob(ILogger<CheckDocumentsToProcessJob> logg
var docsToProcess = await context
.PaperlessDocuments
.Where(x => x.DocumentState == Enums.EOperationState.Created)
.Where(x => x.DocumentState == Enums.EDocumentState.Created)
.OrderBy(x => x.CreatedAt)
.ToListAsync();
documentProcessingService.Enqueue(docsToProcess);
documentProcessingService.Process();
await documentProcessingService.Enqueue(docsToProcess);
await documentProcessingService.Process();
}
}