1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-26 18:21:01 +00:00

refactor(storage): split DeleteContentRemovedEntries into 2 functions and fix condition

- Add `content IS NOT NULL` to avoid clearing the same entries over and over
- Create `DeleteRemovedEntriesEnclosures` and `ClearRemovedEntriesContent` that report individual counts
This commit is contained in:
Frédéric Guillot 2025-08-16 21:12:36 -07:00
parent 5c26e06780
commit a16ac51326
2 changed files with 34 additions and 18 deletions

View file

@ -47,10 +47,17 @@ func runCleanupTasks(store *storage.Storage) {
}
}
if rowsAffected, err := store.DeleteContentRemovedEntries(); err != nil {
slog.Error("Unable to delete the content of removed entries", slog.Any("error", err))
if enclosuresAffected, err := store.DeleteRemovedEntriesEnclosures(); err != nil {
slog.Error("Unable to delete enclosures from removed entries", slog.Any("error", err))
} else {
slog.Info("Deleting content of removed entries completed",
slog.Int64("removed_entries_content_removed", rowsAffected))
slog.Info("Deleting enclosures from removed entries completed",
slog.Int64("removed_entries_enclosures_deleted", enclosuresAffected))
}
if contentAffected, err := store.ClearRemovedEntriesContent(); err != nil {
slog.Error("Unable to clear content from removed entries", slog.Any("error", err))
} else {
slog.Info("Clearing content from removed entries completed",
slog.Int64("removed_entries_content_cleared", contentAffected))
}
}