Fix update feeds thinking all items already exist

Repo.exists? needs a query, not the keyword list
This commit is contained in:
Shadowfacts 2021-09-08 20:10:19 -04:00
parent a02ec174be
commit ddceb28803
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,7 @@
defmodule Frenzy.Item do
use Ecto.Schema
import Ecto.Changeset
import Ecto.Query
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint
@ -87,6 +88,6 @@ defmodule Frenzy.Item do
end
def exists?(feed_id, guid) do
Frenzy.Repo.exists?(__MODULE__, feed_id: feed_id, guid: guid)
Frenzy.Repo.exists?(from i in __MODULE__, where: i.feed_id == ^feed_id and i.guid == ^guid)
end
end

View File

@ -159,7 +159,6 @@ defmodule Frenzy.UpdateFeeds do
end
Enum.each(rss.items, fn entry ->
# todo: use Repo.exists for this
unless Item.exists?(feed.id, entry.guid) do
CreateItem.start_link(feed, entry)
end