mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2025-04-24 05:47:41 -04:00
Switch to killing during chunking
This commit is contained in:
parent
92d3206f12
commit
7302a8f76d
3 changed files with 3 additions and 4 deletions
|
@ -1,7 +1,6 @@
|
|||
defmodule Pleroma.Chaos do
|
||||
def kill_random_worker(pid) do
|
||||
with true <- :sys.get_state(pid).pool in [:media, :rich_media],
|
||||
true <- Enum.random(0..10) >= 5 do
|
||||
with true <- Enum.random(0..100) >= 75 do
|
||||
Process.exit(pid, :kill)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,8 +30,7 @@ defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do
|
|||
start_worker(opts, true)
|
||||
end
|
||||
|
||||
{:ok, pid} = res ->
|
||||
Task.start(fn -> Pleroma.Chaos.kill_random_worker(pid) end)
|
||||
res ->
|
||||
res
|
||||
end
|
||||
end
|
||||
|
|
|
@ -220,6 +220,7 @@ defmodule Pleroma.ReverseProxy do
|
|||
Keyword.get(opts, :max_body_length, @max_body_length)
|
||||
),
|
||||
{:ok, conn} <- chunk(conn, data) do
|
||||
Pleroma.Chaos.kill_random_worker(self())
|
||||
chunk_reply(conn, client, opts, sent_so_far, duration)
|
||||
else
|
||||
:done -> {:ok, conn}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue