Commit: 33983d7
Parent: aab03b1

Revert `GetCreatedBefore` query

Mårten Åsberg committed on 2026-05-16 at 10:28
src/Cli/Program.cs +5 -11
diff --git a/src/Cli/Program.cs b/src/Cli/Program.cs
index fc0c9dc..2f8449e 100644
@@ -1,5 +1,4 @@
using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Slopper.Cli;
@@ -14,7 +13,7 @@ var builder = Host.CreateApplicationBuilder();
builder.ConfigureOpenTelemetry();
builder.Services.AddClipSelector().AddClipGenerator();
builder.Services.AddClipSelector().AddClipGenerator().AddCleaner();
builder.Services.AddJellyfinDatabase().AddSlopperDatabase().AddFfmpegServices().AddAi().AddYouTubeUploader();
@@ -28,13 +27,8 @@ var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
var logger = app.Services.GetRequiredService<ILogger<Program>>();
using var scope = app.Services.CreateScope();
var clipRepository = scope.ServiceProvider.GetRequiredService<IClipRepository>();
var cutoffDateTime = DateTimeOffset.Parse(args[0]);
var clips = clipRepository.GetCreatedBefore(cutoffDateTime, lifetime.ApplicationStopping);
await foreach (var clip in clips)
{
logger.LogInformation("{ClipId} was created before {CutoffDateTime}", clip.Id, cutoffDateTime);
}
var cleaner = scope.ServiceProvider.GetRequiredService<Cleaner>();
await cleaner.Cleanup(lifetime.ApplicationStopping);
await app.StopAsync();
src/Infrastructure/Database/Slopper/ClipRepository.cs +3 -2
diff --git a/src/Infrastructure/Database/Slopper/ClipRepository.cs b/src/Infrastructure/Database/Slopper/ClipRepository.cs
index aa1387b..7a59188 100644
@@ -33,8 +33,9 @@ internal sealed class ClipRepository(SlopperDbContext slopperContext) : IClipRep
WHERE CreatedAt < {before:yyyy-MM-dd HH:mm:ss.FFFFFFFzzz} AND RemovedAt IS NULL
"""
)
.Take(10)
.OrderByDescending(c => c.Id)
.Include(c => c.Tags)
.Include(c => c.Uploads)
.OrderBy(c => c.Id)
.AsAsyncEnumerable();
public IAsyncEnumerable<Clip> GetNotUploadedTo(string platform, CancellationToken cancellationToken) =>