From 4d7843ee5f9d71ba8c18492d873ce546df153f81 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Wed, 8 Sep 2021 20:17:33 -0400 Subject: [PATCH] Add force update feeds --- lib/frenzy/update_feeds.ex | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/frenzy/update_feeds.ex b/lib/frenzy/update_feeds.ex index be95a45..39dc773 100644 --- a/lib/frenzy/update_feeds.ex +++ b/lib/frenzy/update_feeds.ex @@ -53,6 +53,20 @@ defmodule Frenzy.UpdateFeeds do Logger.info("Updating #{count} feeds") + do_update_feeds(feeds) + + prune_old_items() + end + + def force_update_feeds() do + feeds = Repo.all(Feed) + + Logger.info("Force updating #{Enum.count(feeds)} feeds") + + do_update_feeds(feeds) + end + + defp do_update_feeds(feeds) do Enum.each(feeds, fn feed -> try do update_feed(feed) @@ -63,8 +77,6 @@ defmodule Frenzy.UpdateFeeds do ) end end) - - prune_old_items() end defp prune_old_items() do