HTTP: radically simplify pool checkin/checkout
authorrinpatch <rinpatch@sdf.org>
Thu, 3 Sep 2020 20:15:22 +0000 (23:15 +0300)
committerrinpatch <rinpatch@sdf.org>
Thu, 3 Sep 2020 20:44:13 +0000 (23:44 +0300)
commitd34fe2840d969c30b393cfb73e34b6301027c776
tree980680cc52487cb63d1c406879b3d9094e140489
parent9433311923d4b41b057ce6cb1632ff27d46919b4
HTTP: radically simplify pool checkin/checkout

Use a custom tesla middleware instead of adapter helper function +
custom redirect middleware.

This will also fix "Client died before releasing the connection"
messages when the request pool is overloaded. Since the checkout is
now done after passing ConcurrentLimiter.

This is technically less efficient, since the connection needs to be
checked in/out every time the middleware is left or entered respectively.
But I don't think the nanoseconds we might lose on redirects
to the same host are worth the complexity.
lib/pleroma/http/adapter_helper.ex
lib/pleroma/http/adapter_helper/gun.ex
lib/pleroma/http/adapter_helper/hackney.ex
lib/pleroma/http/http.ex
lib/pleroma/tesla/middleware/connection_pool.ex [new file with mode: 0644]
lib/pleroma/tesla/middleware/follow_redirects.ex [deleted file]