fix crawls of well-connected instances

main
Tao Bojlén 2023-06-10 09:36:03 +01:00
rodzic b7cb7fa685
commit 4d4193ff49
3 zmienionych plików z 10 dodań i 5 usunięć

Wyświetl plik

@ -35,7 +35,7 @@ jobs:
- name: Build & push - name: Build & push
uses: depot/build-push-action@v1 uses: depot/build-push-action@v1
with: with:
project: 3tz1wxj8cr project: rktsv8c4sk
context: backend context: backend
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}

1
.gitignore vendored
Wyświetl plik

@ -5,6 +5,7 @@ data/
*.class *.class
backend/.sobelow backend/.sobelow
node_modules/
# Environments # Environments
.env .env

Wyświetl plik

@ -235,9 +235,12 @@ defmodule Backend.Crawler do
Enum.map(result.federation_restrictions, fn {domain, _restriction_type} -> domain end) Enum.map(result.federation_restrictions, fn {domain, _restriction_type} -> domain end)
) )
|> Enum.map(&%{domain: &1, inserted_at: now, updated_at: now, next_crawl: now}) |> Enum.map(&%{domain: &1, inserted_at: now, updated_at: now, next_crawl: now})
|> Enum.chunk_every(5000)
Instance new_instances
|> Repo.insert_all(new_instances, on_conflict: :nothing, conflict_target: :domain) |> Enum.each(fn chunk ->
Repo.insert_all(Instance, chunk, on_conflict: :nothing, conflict_target: :domain)
end)
Repo.transaction(fn -> Repo.transaction(fn ->
## Save peer relationships ## ## Save peer relationships ##
@ -274,9 +277,10 @@ defmodule Backend.Crawler do
updated_at: now updated_at: now
} }
) )
|> Enum.chunk_every(5000)
InstancePeer new_instance_peers
|> Repo.insert_all(new_instance_peers) |> Enum.each(fn chunk -> Repo.insert_all(InstancePeer, chunk) end)
end) end)
## Save federation restrictions ## ## Save federation restrictions ##