More work
This commit is contained in:
1 parent
c06f06c6ce
commit
8b476e6939
20 files changed
+871
-22
No files matched your search
@@ -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();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user