diff --git a/lib/bdfr_browser/importer.ex b/lib/bdfr_browser/importer.ex index eaf9a32..02f280c 100644 --- a/lib/bdfr_browser/importer.ex +++ b/lib/bdfr_browser/importer.ex @@ -144,10 +144,12 @@ defmodule BdfrBrowser.Importer do @impl true def handle_cast(:background_import, %State{last_import: last_import} = state) do + current_time = System.os_time(:second) + _ = subreddits() _ = posts_and_comments(last_import) _ = chats() - {:noreply, %State{state | last_import: System.os_time(:second)}} + {:noreply, %State{state | last_import: current_time}} end @impl true @@ -310,7 +312,7 @@ defmodule BdfrBrowser.Importer do defp import_post(post, subreddit) when not is_nil(subreddit) do id = post["id"] - db_post = id |> Post.get_import() |> Repo.one() + db_post = Repo.get(Post, id) if is_nil(db_post) do %Post{ @@ -333,7 +335,7 @@ defmodule BdfrBrowser.Importer do defp import_comment(comment, post, parent) when not is_nil(post) do id = comment["id"] - db_comment = id |> Comment.get_import() |> Repo.one() + db_comment = Repo.get(Comment, id) {:ok, parent} = if is_nil(db_comment) do