feat(sync): make annotation tombstone TTL configurable
The 30-day retention window for soft-deleted annotations was a package const; move it behind the registry so it can be tuned live. annotations.go: - AnnotationService gains an optional *database.SettingsRegistry and a tombstoneTTL() helper. The skip-resurrect checks and the purge cutoff now call it instead of reading the TombstoneTTL const directly. - Add ActiveTombstoneTTL() so callers outside the sync package can compute cutoffs consistently with the service. - The package-level TombstoneTTL const is retained as the fallback for tests / unwired code paths. kobo.go, koreader.go: - The per-book tombstone sweep cutoff now uses h.annotationSvc.ActiveTombstoneTTL() instead of the wsync.TombstoneTTL const, so both the service and the handlers honor the configured TTL.
This commit is contained in:
@@ -854,7 +854,7 @@ func (h *KOReaderHandler) GetMetadata(c *echo.Context) error {
|
||||
annotationsResponse.Bookmarks = append(annotationsResponse.Bookmarks, koreaderBookmark)
|
||||
}
|
||||
|
||||
cutoff := pgtype.Timestamptz{Time: time.Now().Add(-wsync.TombstoneTTL), Valid: true}
|
||||
cutoff := pgtype.Timestamptz{Time: time.Now().Add(-h.annotationSvc.ActiveTombstoneTTL()), Valid: true}
|
||||
tombstones, _ := h.db.GetTombstonedAnnotationsForBook(c.Request().Context(), database.GetTombstonedAnnotationsForBookParams{
|
||||
MediaItemID: pgBookUUID,
|
||||
UserID: pgUserID,
|
||||
|
||||
Reference in New Issue
Block a user