Compare commits
2 commits
5261368514
...
6d9db86e30
Author | SHA1 | Date | |
---|---|---|---|
6d9db86e30 | |||
c6a1d6e12b |
2 changed files with 20 additions and 3 deletions
15
.forgejo/workflows/build.yaml
Normal file
15
.forgejo/workflows/build.yaml
Normal 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
|
|
@ -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
|
||||||
|
|
Reference in a new issue