summaryrefslogtreecommitdiff
path: root/lib/mix
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-12-16 11:35:45 +0000
committerlain <lain@soykaf.club>2020-12-16 11:35:45 +0000
commit8b8c317c0ff1534d3296369ba315b8919e8dc55c (patch)
treea5de91eecea4b6cd62a96d800ed714e50c649959 /lib/mix
parent6bb4f4e1721d30762978b59a1aed11137223c183 (diff)
parentc37f78d1c87b0554b29213ab77f484747fa48f88 (diff)
downloadpleroma-8b8c317c0ff1534d3296369ba315b8919e8dc55c.tar.gz
pleroma-8b8c317c0ff1534d3296369ba315b8919e8dc55c.zip
Merge branch 'fix/2336-mastoapi-ws-posts-dropping' into 'develop'
Fix mastoapi ws posts dropping Closes #2336 See merge request pleroma/pleroma!3198
Diffstat (limited to 'lib/mix')
-rw-r--r--lib/mix/pleroma.ex16
-rw-r--r--lib/mix/tasks/pleroma/database.ex12
2 files changed, 23 insertions, 5 deletions
diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex
index 7575f0ef8..a33a9951c 100644
--- a/lib/mix/pleroma.ex
+++ b/lib/mix/pleroma.ex
@@ -12,7 +12,8 @@ defmodule Mix.Pleroma do
:cachex,
:flake_id,
:swoosh,
- :timex
+ :timex,
+ :fast_html
]
@cachex_children ["object", "user", "scrubber", "web_resp"]
@doc "Common functions to be reused in mix tasks"
@@ -37,12 +38,23 @@ defmodule Mix.Pleroma do
Enum.each(apps, &Application.ensure_all_started/1)
+ oban_config = [
+ crontab: [],
+ repo: Pleroma.Repo,
+ log: false,
+ queues: [],
+ plugins: []
+ ]
+
children =
[
Pleroma.Repo,
+ Pleroma.Emoji,
{Pleroma.Config.TransferTask, false},
Pleroma.Web.Endpoint,
- {Oban, Pleroma.Config.get(Oban)}
+ {Oban, oban_config},
+ {Majic.Pool,
+ [name: Pleroma.MajicPool, pool_size: Pleroma.Config.get([:majic_pool, :size], 2)]}
] ++
http_children(adapter)
diff --git a/lib/mix/tasks/pleroma/database.ex b/lib/mix/tasks/pleroma/database.ex
index a01c36ece..22151ce08 100644
--- a/lib/mix/tasks/pleroma/database.ex
+++ b/lib/mix/tasks/pleroma/database.ex
@@ -48,9 +48,15 @@ defmodule Mix.Tasks.Pleroma.Database do
def run(["update_users_following_followers_counts"]) do
start_pleroma()
- User
- |> Repo.all()
- |> Enum.each(&User.update_follower_count/1)
+ Repo.transaction(
+ fn ->
+ from(u in User, select: u)
+ |> Repo.stream()
+ |> Stream.each(&User.update_follower_count/1)
+ |> Stream.run()
+ end,
+ timeout: :infinity
+ )
end
def run(["prune_objects" | args]) do