Prune unread items after two weeks

This commit is contained in:
Shadowfacts 2019-11-10 14:03:13 -05:00
parent 1603d907c8
commit 2d88b0b4e1
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 5 additions and 3 deletions

View File

@ -49,9 +49,11 @@ defmodule Frenzy.UpdateFeeds do
defp prune_old_items() do
{count, _} =
from(i in Item,
where: i.read and not i.tombstone,
# where: i.read_date <= from_now(-1, "week"),
where: i.read_date <= from_now(-1, "minute"),
where: not i.tombstone,
# todo: these time intervals should be configurable by the admin
where:
(i.read and i.read_date <= from_now(-1, "week")) or
(not i.read and i.inserted_at <= from_now(-2, "week")),
update: [
set: [tombstone: true, content: nil, creator: nil, date: nil, url: nil, title: nil]
]