Limit number of items in initial sync

This commit is contained in:
Shadowfacts 2022-09-16 16:39:08 -04:00
parent 3129142274
commit 52c6f1ff6c
1 changed files with 7 additions and 1 deletions

View File

@ -146,7 +146,13 @@ defmodule FrenzyWeb.Fervor.ItemsController do
{deleted_ids, upserted} =
case last_sync do
nil ->
items = Repo.all(from i in Item, where: not i.tombstone and i.feed_id in ^feed_ids)
items =
Item
|> where([i], not i.tombstone and i.feed_id in ^feed_ids)
|> order_by([i], desc: i.inserted_at)
|> limit(1000)
|> Repo.all()
{[], items}
_ ->