diff options
author | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-04-08 18:46:01 +0300 |
---|---|---|
committer | Alexander Strizhakov <alex.strizhakov@gmail.com> | 2020-04-08 18:46:01 +0300 |
commit | 5739c498c029914c446656244cdd213a3e358fec (patch) | |
tree | fa8a4785c7261ef5e8baa4cde88caef7d4792f4f | |
parent | dd4d10b275e76afc029aea642ae3d69b07e33d81 (diff) | |
download | pleroma-5739c498c029914c446656244cdd213a3e358fec.tar.gz |
fix for gun connections pool
-rw-r--r-- | CHANGELOG.md | 3 | ||||
-rw-r--r-- | lib/pleroma/gun/conn.ex | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index b6e5d807c..92d1abc4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Mastodon API: Support for `include_types` in `/api/v1/notifications`. </details> +### Fixed +- Gun connections pool `max_connections` option. + ## [2.0.0] - 2019-03-08 ### Security - Mastodon API: Fix being able to request enourmous amount of statuses in timelines leading to DoS. Now limited to 40 per request. diff --git a/lib/pleroma/gun/conn.ex b/lib/pleroma/gun/conn.ex index 20823a765..cd25a2e74 100644 --- a/lib/pleroma/gun/conn.ex +++ b/lib/pleroma/gun/conn.ex @@ -49,8 +49,10 @@ defmodule Pleroma.Gun.Conn do key = "#{uri.scheme}:#{uri.host}:#{uri.port}" + max_connections = pool_opts[:max_connections] || 250 + conn_pid = - if Connections.count(name) < opts[:max_connection] do + if Connections.count(name) < max_connections do do_open(uri, opts) else close_least_used_and_do_open(name, uri, opts) |