Media: instelling Media:AutoCleanupUnattached (standaard true) om ongebruikte uploads te bewaren
Continuous Integration / config-sls (pull_request) Successful in 8s
Continuous Integration / changes (pull_request) Successful in 13s
Continuous Integration / frontend-prepare (pull_request) Skipped
Continuous Integration / frontend-build (pull_request) Skipped
Continuous Integration / frontend-test (pull_request) Skipped
Continuous Integration / frontend-lint (pull_request) Skipped
Continuous Integration / config-asf (pull_request) Successful in 5s
Continuous Integration / compile-sites (pull_request) Successful in 1m31s
Continuous Integration / vulnerability-scan (pull_request) Successful in 1m18s
Continuous Integration / backend-build (pull_request) Successful in 3m10s
Continuous Integration / publish-sls-test (pull_request) Canceled after 0s
Continuous Integration / publish-sls-production (pull_request) Canceled after 0s
Continuous Integration / deploy-sls-test (pull_request) Canceled after 0s
Continuous Integration / deploy-sls-production (pull_request) Canceled after 0s
Continuous Integration / publish-asf-test (pull_request) Canceled after 0s
Continuous Integration / deploy-asf-test (pull_request) Canceled after 0s
Continuous Integration / backend-test (pull_request) Canceled after 1m25s
Continuous Integration / smoke-sls-test (pull_request) Canceled after 0s
Continuous Integration / smoke-asf-test (pull_request) Canceled after 0s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 14:17:28 +01:00
co-authored by Claude Sonnet 5.5
parent caa178a58c
commit a71db84632
5 changed files with 46 additions and 3 deletions
@@ -29,7 +29,11 @@ public class HeroMediaCleanup(
var removed = 0;
// 1. Images that were uploaded but never used by a slide: retire them (their files go on a later run).
foreach (var image in await repository.GetUnattachedImagesCreatedBeforeAsync(cutoff, cancellationToken))
// Skipped when the media library keeps every upload until a person removes it (Media:AutoCleanupUnattached = false).
var unattached = options.Value.AutoCleanupUnattached
? await repository.GetUnattachedImagesCreatedBeforeAsync(cutoff, cancellationToken)
: [];
foreach (var image in unattached)
{
repository.AddRetired(new HeroRetiredFile { Id = Guid.NewGuid(), Kind = "set", Key = image.SetHash, RetiredAt = cutoff.AddSeconds(-1) });
repository.AddRetired(new HeroRetiredFile { Id = Guid.NewGuid(), Kind = "original", Key = image.OriginalKey, RetiredAt = cutoff.AddSeconds(-1) });