Allow users to disable auto-remove
Adds ARCHIVE_READ_DAYS="-1"
This commit is contained in:
parent
6764a420b0
commit
22b68eefd8
1 changed files with 3 additions and 0 deletions
|
@ -188,6 +188,9 @@ func (s *Storage) UpdateEntries(userID, feedID int64, entries model.Entries, upd
|
||||||
|
|
||||||
// ArchiveEntries changes the status of read items to "removed" after specified days.
|
// ArchiveEntries changes the status of read items to "removed" after specified days.
|
||||||
func (s *Storage) ArchiveEntries(days int) error {
|
func (s *Storage) ArchiveEntries(days int) error {
|
||||||
|
if days < 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
query := fmt.Sprintf(`
|
query := fmt.Sprintf(`
|
||||||
UPDATE entries SET status='removed'
|
UPDATE entries SET status='removed'
|
||||||
WHERE id=ANY(SELECT id FROM entries WHERE status='read' AND starred is false AND published_at < now () - '%d days'::interval LIMIT 5000)
|
WHERE id=ANY(SELECT id FROM entries WHERE status='read' AND starred is false AND published_at < now () - '%d days'::interval LIMIT 5000)
|
||||||
|
|
Loading…
Reference in a new issue