Compare commits

..

2 commits

Author SHA1 Message Date
6d9db86e30
fix: Import
All checks were successful
Build / build (push) Successful in 4m8s
2023-10-20 19:49:51 +02:00
c6a1d6e12b
fix: Enable CI builds 2023-10-20 19:22:07 +02:00
2 changed files with 20 additions and 3 deletions

View file

@ -0,0 +1,15 @@
name: Build
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest-amd64
uses: daniel/reusable-workflows/.github/workflows/nix-flake-build.yaml@main
with:
runner: ubuntu-latest-amd64
secrets: inherit

View file

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