diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-03-25 01:57:19 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-03-25 01:57:46 +1100 |
| commit | 6c06dfc4f83f30292e65c08a3cb0c48401d4bfa7 (patch) | |
| tree | 511f88873fa6173637115a38c31ec5f8018e108e /Services/OcrService.cs | |
| parent | c751709b1b4fe6f16fd84647e8e071455e7b78d6 (diff) | |
v0.2av0.2a
Diffstat (limited to 'Services/OcrService.cs')
| -rw-r--r-- | Services/OcrService.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Services/OcrService.cs b/Services/OcrService.cs index 4d21705..40905aa 100644 --- a/Services/OcrService.cs +++ b/Services/OcrService.cs @@ -18,18 +18,21 @@ public class OcrService : IHostedService { private Timer timer; + private IConfigService configService; private IServiceScopeFactory scopeFactory; private ILogger<OcrService> logger; private IDbContextFactory<HBContext> dbFactory; public OcrService( + IConfigService configService, IServiceScopeFactory scopeFactory, ILogger<OcrService> logger, IDbContextFactory<HBContext> dbFactory) { - this.scopeFactory = scopeFactory; - this.logger = logger; - this.dbFactory = dbFactory; + this.configService = configService; + this.scopeFactory = scopeFactory; + this.logger = logger; + this.dbFactory = dbFactory; timer = new((object? state) => { if(task is not null && !task.IsCompleted) @@ -40,8 +43,11 @@ public class OcrService : IHostedService { } public Task StartAsync(CancellationToken ct) { - logger.LogInformation("Service starting..."); - timer.Change(StartupDelay, ProcessInterval); + if(configService.EnableOcr) { + logger.LogInformation("Service starting..."); + timer.Change(StartupDelay, ProcessInterval); + } + return Task.CompletedTask; } @@ -53,8 +59,6 @@ public class OcrService : IHostedService { } async Task ProcessAllAsync(CancellationToken ct) { - return; - using var scope = scopeFactory.CreateScope(); var mediaService = scope.ServiceProvider .GetRequiredService<IMediaService>(); |
