@@ -8,9 +8,15 @@ import (
88 "github.com/jackc/pgx/v5"
99)
1010
11- // todo: time range beyond 30 days
12- // - how + when to expand time range,
13- // - how to de-dupe items from appearing twice when expanding time range... is tricky
11+ // todo: feed currently hard coded to go back: 1 YEAR
12+ // this is probably fine for now, as ES feed only went back 1 MONTH.
13+ // BUT if we want to support going back further:
14+ // - in a loop... start with @before = now()
15+ // - if len(rows) < limit, expand time range until limit is reached.
16+ // this could also work better if client sent some date hints...
17+ //
18+ // we could also get rid of date range filter... it would make feed slower...
19+ // but maybe it'd be okay?
1420func (app * ApiServer ) v1UsersFeed (c * fiber.Ctx ) error {
1521 myId := app .getMyId (c )
1622
@@ -46,7 +52,7 @@ func (app *ApiServer) v1UsersFeed(c *fiber.Ctx) error {
4652 WHERE
4753 @filter in ('all', 'repost')
4854 AND reposts.created_at < @before
49- AND reposts.created_at >= @before - INTERVAL '30 DAYS '
55+ AND reposts.created_at >= @before - INTERVAL '1 YEAR '
5056 AND reposts.is_delete = false
5157 AND (tracks.track_id IS NOT NULL OR playlists.playlist_id IS NOT NULL)
5258 GROUP BY entity_type, entity_id
@@ -63,7 +69,7 @@ func (app *ApiServer) v1UsersFeed(c *fiber.Ctx) error {
6369 join follow_set on owner_id = user_id
6470 where @filter in ('all', 'original')
6571 AND created_at < @before
66- AND created_at >= @before::timestamp - INTERVAL '30 DAYS '
72+ AND created_at >= @before::timestamp - INTERVAL '1 YEAR '
6773 AND is_unlisted = false
6874 AND is_delete = false
6975 AND stem_of is null
@@ -80,7 +86,7 @@ func (app *ApiServer) v1UsersFeed(c *fiber.Ctx) error {
8086 join follow_set on playlist_owner_id = user_id
8187 where @filter in ('all', 'original')
8288 AND created_at < @before
83- AND created_at >= @before - INTERVAL '30 DAYS '
89+ AND created_at >= @before - INTERVAL '1 YEAR '
8490 AND is_delete = false
8591 AND is_private = false
8692 )
0 commit comments