Commit graph

39 commits

Author SHA1 Message Date
Alexander Strizhakov
0374df1d12
other files consistency 2020-10-13 16:38:19 +03:00
Alexander Strizhakov
696bf09433
passing adapter options directly without adapter key 2020-09-07 19:59:17 +03:00
rinpatch
d34fe2840d 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.
2020-09-03 23:44:13 +03:00
href
4bac25e6f5 Don't enable Pleroma.HTTP.Middleware.FollowRedirects unless Gun is used 2020-07-18 13:17:38 +02:00
rinpatch
4128e3a84a HTTP: Implement max request limits 2020-07-15 15:26:35 +03:00
rinpatch
94c8f3cfaf Use a custom pool-aware FollowRedirects middleware 2020-07-15 15:26:35 +03:00
rinpatch
58a4f350a8 Refactor gun pooling and simplify adapter option insertion
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
2020-07-15 15:17:27 +03:00
Maksim Pechnikov
721fc7c554 added wrapper Pleroma.HTTP for Tzdata.HTTPClient 2020-06-24 09:12:32 +03:00
Alexander Strizhakov
1306b92997
clean up 2020-03-12 18:29:07 +03:00
Alexander Strizhakov
f0753eed0f
removing try block in tesla request
added mocks for tests which fail with Tesla.Mock.Error
2020-03-05 17:31:06 +03:00
Mark Felder
4427161ca3 Merge branch 'develop' into gun 2020-03-03 17:15:49 -06:00
Mark Felder
05da5f5cca Update Copyrights 2020-03-03 16:44:49 -06:00
Alexander Strizhakov
24bf5c4e89
remove try block from pool request 2020-03-03 17:27:56 +03:00
Alexander Strizhakov
6ebf389d6e
poolboy timeout fix 2020-03-03 16:51:49 +03:00
Alexander Strizhakov
05429730e4
unnecessary with 2020-03-03 15:11:48 +03:00
Alexander Strizhakov
a21a66972f Apply suggestion to lib/pleroma/http/http.ex 2020-03-03 09:52:01 +00:00
Alexander Strizhakov
614e3934f9 Apply suggestion to lib/pleroma/http/http.ex 2020-03-03 09:50:42 +00:00
Alexander Strizhakov
514c899275
adding gun adapter 2020-02-18 08:19:01 +03:00
rinpatch
b001b8891a Merge the default options with custom ones in ReverseProxy and
Pleroma.HTTP
2019-07-12 23:52:26 +03:00
Egor Kislitsyn
99f70c7e20 Use Pleroma.Config everywhere 2019-05-30 15:33:58 +07:00
William Pitcock
773f532b14 http: actually pass the options list to the Connection factory 2019-03-08 22:56:16 +00:00
William Pitcock
2a83c0ba93 http: safely catch erlang exits and elixir errors from hackney (ref #672) 2019-03-08 22:56:16 +00:00
KokaKiwi
b57913b13a Fix supported TLS versions as TLS 1.3 support seems buggy. 2019-03-04 11:30:26 +01:00
William Pitcock
2d3241753f http: add support for query parameters, use Jason for JSON encoding instead of Poison like everywhere else 2019-01-15 19:31:13 +00:00
lain
096a927805 Merge remote-tracking branch 'origin/develop' into pool-usage 2019-01-01 14:19:55 +01:00
lain
d4799e0dc2 Remove default pool, it's used automatically anyway. 2019-01-01 13:49:24 +01:00
William Pitcock
980b5288ed update copyright years to 2019 2018-12-31 15:41:47 +00:00
Maksim Pechnikov
523848d1fd Salmon# fixed publish an activity to remote accounts 2018-12-29 12:48:54 +03:00
William Pitcock
2791ce9a1f add license boilerplate to pleroma core 2018-12-23 20:56:42 +00:00
Maksim Pechnikov
50e72f6c48 remove httpoison_mock 2018-12-04 18:09:22 +03:00
Maksim Pechnikov
dd8aee332c formatting the code 2018-12-04 17:48:55 +03:00
Maksim Pechnikov
a9e4a97586 update test 2018-12-04 14:04:06 +03:00
Maksim Pechnikov
3ce16e5a56 init tesla and updated the http requests in Pleroma.Web.Websub 2018-12-04 14:03:32 +03:00
William Pitcock
c302c619b9 http: fix mediaproxy 2018-10-26 06:38:08 +00:00
William Pitcock
7338368ad9 http: enable keepalive / connection pooling (closes #336) 2018-10-26 03:06:42 +00:00
William Pitcock
290798b821 http: fix TLS server name indication
by default, hackney only sent TLS server name indication if TLS was locked
to TLS 1.2.

since there are many instances out there not speaking TLS 1.2, it is not
acceptable to lock SNI to TLS 1.2.

closes #261
2018-08-24 20:04:50 +00:00
lain
4afbef39f4 Format the code. 2018-03-30 15:01:53 +02:00
Jeff Becker
066fe1a697
use nil instead of empty string 2018-01-29 10:06:16 -05:00
Jeff Becker
5ddd15d794
make httppoison use configurable http proxy 2017-12-30 13:08:36 -05:00