aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/gun/connection_pool.ex
AgeCommit message (Collapse)Author
2022-02-25Copyright bump for 2022Sean King
2021-01-13Bump Copyright to 2021Haelwenn (lanodan) Monnier
grep -rl '# Copyright © .* Pleroma' * | xargs sed -i 's;Copyright © .* Pleroma .*;Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>;'
2020-10-12Add missing Copyright headersMark Felder
2020-08-01ConnectionPool: fix gun open errors being returned without an error tuplerinpatch
When gun shuts down due to the host being unreachable, the worker process shuts down with the same shutdown reason since they are linked. Gun doesn't have error tuples in it's shutdown reason though, so we need to handle it in get_conn. Closes #2008
2020-07-28gun ConnectionPool: Re-add a missing cast for remove_clientrinpatch
2020-07-28gun ConnectionPool: replace casts with callsrinpatch
The slowdown from this is most likely immesurable, however it eliminates possible false positives when tracking dead clients.
2020-07-15ConnectionPool.Worker: do not stop with an error when there is a timeoutrinpatch
This produced error log messages about GenServer termination every time the connection was not open due to a timeout. Instead we stop with `{:shutdown, <gun_error>}` since shutting down when the connection can't be established is normal behavior.
2020-07-15Ensure connections error get known by the callerhref
2020-07-15Connection Pool: register workers using :viarinpatch
2020-07-15Connection pool: Fix race conditions in limit enforcementrinpatch
Fixes race conditions in limit enforcement by putting worker processes in a DynamicSupervisor
2020-07-15Connection pool: check that there actually is a resultrinpatch
Sometimes connections died before being released to the pool, resulting in MatchErrors
2020-07-15Connection Pool: don't enforce pool limits if no new connection needs to be ↵rinpatch
opened
2020-07-15Refactor gun pooling and simplify adapter option insertionrinpatch
This patch refactors gun pooling to use Elixir process registry and simplifies adapter option insertion. Having the pool use process registry instead of a GenServer has a number of advantages: - Simpler code: the initial implementation adds about half the lines of code it deletes - Concurrency: unlike a GenServer, ETS-based registry can handle multiple checkout/checkin requests at the same time - Precise and easy idle connection clousure: current proposal for closing idle connections in the GenServer-based pool needs to filter through all connections once a minute and compare their last active time with closing time. With Elixir process registry this can be done by just using `Process.send_after`/`Process.cancel_timer` in the worker process. - Lower memory footprint: In my tests `gun-memory-leak` branch uses about 290mb on peak load (250 connections) and 235mb on idle (5-10 connections). Registry-based pool uses 210mb on idle and 240mb on peak load