Merge branch 'develop' into cinnamon-hate
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending
This commit is contained in:
commit
af2c3d6e1e
10 changed files with 45 additions and 11 deletions
|
@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- Prometheus metrics exporting from `/api/v1/akkoma/metrics`
|
- Prometheus metrics exporting from `/api/v1/akkoma/metrics`
|
||||||
|
- Ability to alter http pool size
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Non-finch HTTP adapters
|
- Non-finch HTTP adapters
|
||||||
|
@ -17,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Changed
|
### Changed
|
||||||
- Return HTTP error 413 when uploading an avatar or banner that's above the configured upload limit instead of a 500.
|
- Return HTTP error 413 when uploading an avatar or banner that's above the configured upload limit instead of a 500.
|
||||||
- Non-admin users now cannot register `admin` scope tokens (not security-critical, they didn't work before, but you _could_ create them)
|
- Non-admin users now cannot register `admin` scope tokens (not security-critical, they didn't work before, but you _could_ create them)
|
||||||
|
- Rich media will now backoff for 20 minutes after a failure
|
||||||
|
|
||||||
### Upgrade notes
|
### Upgrade notes
|
||||||
- Ensure `config :tesla, :adapter` is either unset, or set to `{Tesla.Adapter.Finch, name: MyFinch}` in your .exs config
|
- Ensure `config :tesla, :adapter` is either unset, or set to `{Tesla.Adapter.Finch, name: MyFinch}` in your .exs config
|
||||||
|
|
|
@ -179,6 +179,7 @@
|
||||||
receive_timeout: :timer.seconds(15),
|
receive_timeout: :timer.seconds(15),
|
||||||
proxy_url: nil,
|
proxy_url: nil,
|
||||||
user_agent: :default,
|
user_agent: :default,
|
||||||
|
pool_size: 50,
|
||||||
adapter: []
|
adapter: []
|
||||||
|
|
||||||
config :pleroma, :instance,
|
config :pleroma, :instance,
|
||||||
|
@ -425,7 +426,7 @@
|
||||||
Pleroma.Web.RichMedia.Parsers.TwitterCard,
|
Pleroma.Web.RichMedia.Parsers.TwitterCard,
|
||||||
Pleroma.Web.RichMedia.Parsers.OEmbed
|
Pleroma.Web.RichMedia.Parsers.OEmbed
|
||||||
],
|
],
|
||||||
failure_backoff: 60_000,
|
failure_backoff: :timer.minutes(20),
|
||||||
ttl_setters: [Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl]
|
ttl_setters: [Pleroma.Web.RichMedia.Parser.TTL.AwsSignedUrl]
|
||||||
|
|
||||||
config :pleroma, :media_proxy,
|
config :pleroma, :media_proxy,
|
||||||
|
|
|
@ -2661,6 +2661,13 @@
|
||||||
"What user agent to use. Must be a string or an atom `:default`. Default value is `:default`.",
|
"What user agent to use. Must be a string or an atom `:default`. Default value is `:default`.",
|
||||||
suggestions: ["Pleroma", :default]
|
suggestions: ["Pleroma", :default]
|
||||||
},
|
},
|
||||||
|
%{
|
||||||
|
key: :pool_size,
|
||||||
|
type: :integer,
|
||||||
|
description:
|
||||||
|
"Number of concurrent outbound HTTP requests to allow. Default 50.",
|
||||||
|
suggestions: [50]
|
||||||
|
},
|
||||||
%{
|
%{
|
||||||
key: :adapter,
|
key: :adapter,
|
||||||
type: :keyword,
|
type: :keyword,
|
||||||
|
|
|
@ -259,10 +259,12 @@ def limiters_setup do
|
||||||
defp http_children do
|
defp http_children do
|
||||||
proxy_url = Config.get([:http, :proxy_url])
|
proxy_url = Config.get([:http, :proxy_url])
|
||||||
proxy = Pleroma.HTTP.AdapterHelper.format_proxy(proxy_url)
|
proxy = Pleroma.HTTP.AdapterHelper.format_proxy(proxy_url)
|
||||||
|
pool_size = Config.get([:http, :pool_size])
|
||||||
|
|
||||||
config =
|
config =
|
||||||
[:http, :adapter]
|
[:http, :adapter]
|
||||||
|> Config.get([])
|
|> Config.get([])
|
||||||
|
|> Pleroma.HTTP.AdapterHelper.add_pool_size(pool_size)
|
||||||
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
|> Pleroma.HTTP.AdapterHelper.maybe_add_proxy_pool(proxy)
|
||||||
|> Keyword.put(:name, MyFinch)
|
|> Keyword.put(:name, MyFinch)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,9 @@ defp reboot_time_subkeys,
|
||||||
do: [
|
do: [
|
||||||
{:pleroma, Pleroma.Captcha, [:seconds_valid]},
|
{:pleroma, Pleroma.Captcha, [:seconds_valid]},
|
||||||
{:pleroma, Pleroma.Upload, [:proxy_remote]},
|
{:pleroma, Pleroma.Upload, [:proxy_remote]},
|
||||||
{:pleroma, :instance, [:upload_limit]}
|
{:pleroma, :instance, [:upload_limit]},
|
||||||
|
{:pleroma, :http, [:pool_size]},
|
||||||
|
{:pleroma, :http, [:proxy_url]}
|
||||||
]
|
]
|
||||||
|
|
||||||
def start_link(restart_pleroma? \\ true) do
|
def start_link(restart_pleroma? \\ true) do
|
||||||
|
|
|
@ -47,6 +47,13 @@ def maybe_add_proxy_pool(opts, proxy) do
|
||||||
|> put_in([:pools, :default, :conn_opts, :proxy], proxy)
|
|> put_in([:pools, :default, :conn_opts, :proxy], proxy)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def add_pool_size(opts, pool_size) do
|
||||||
|
opts
|
||||||
|
|> maybe_add_pools()
|
||||||
|
|> maybe_add_default_pool()
|
||||||
|
|> put_in([:pools, :default, :size], pool_size)
|
||||||
|
end
|
||||||
|
|
||||||
defp maybe_add_pools(opts) do
|
defp maybe_add_pools(opts) do
|
||||||
if Keyword.has_key?(opts, :pools) do
|
if Keyword.has_key?(opts, :pools) do
|
||||||
opts
|
opts
|
||||||
|
|
|
@ -11,7 +11,7 @@ defmodule Pleroma.Stats do
|
||||||
alias Pleroma.Repo
|
alias Pleroma.Repo
|
||||||
alias Pleroma.User
|
alias Pleroma.User
|
||||||
|
|
||||||
@interval :timer.seconds(60)
|
@interval :timer.seconds(300)
|
||||||
|
|
||||||
def start_link(_) do
|
def start_link(_) do
|
||||||
GenServer.start_link(
|
GenServer.start_link(
|
||||||
|
@ -85,14 +85,24 @@ def calculate_stat_data do
|
||||||
where: not u.invisible
|
where: not u.invisible
|
||||||
)
|
)
|
||||||
|
|
||||||
|
remote_users_query =
|
||||||
|
from(u in User,
|
||||||
|
where: u.is_active == true,
|
||||||
|
where: u.local == false,
|
||||||
|
where: not is_nil(u.nickname),
|
||||||
|
where: not u.invisible
|
||||||
|
)
|
||||||
|
|
||||||
user_count = Repo.aggregate(users_query, :count, :id)
|
user_count = Repo.aggregate(users_query, :count, :id)
|
||||||
|
remote_user_count = Repo.aggregate(remote_users_query, :count, :id)
|
||||||
|
|
||||||
%{
|
%{
|
||||||
peers: peers,
|
peers: peers,
|
||||||
stats: %{
|
stats: %{
|
||||||
domain_count: domain_count,
|
domain_count: domain_count,
|
||||||
status_count: status_count || 0,
|
status_count: status_count || 0,
|
||||||
user_count: user_count
|
user_count: user_count,
|
||||||
|
remote_user_count: remote_user_count
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -109,7 +109,8 @@ defp summary_metrics do
|
||||||
summary("vm.total_run_queue_lengths.io"),
|
summary("vm.total_run_queue_lengths.io"),
|
||||||
last_value("pleroma.local_users.total"),
|
last_value("pleroma.local_users.total"),
|
||||||
last_value("pleroma.domains.total"),
|
last_value("pleroma.domains.total"),
|
||||||
last_value("pleroma.local_statuses.total")
|
last_value("pleroma.local_statuses.total"),
|
||||||
|
last_value("pleroma.remote_users.total")
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -127,5 +128,6 @@ def instance_stats do
|
||||||
:telemetry.execute([:pleroma, :local_users], %{total: stats.user_count}, %{})
|
:telemetry.execute([:pleroma, :local_users], %{total: stats.user_count}, %{})
|
||||||
:telemetry.execute([:pleroma, :domains], %{total: stats.domain_count}, %{})
|
:telemetry.execute([:pleroma, :domains], %{total: stats.domain_count}, %{})
|
||||||
:telemetry.execute([:pleroma, :local_statuses], %{total: stats.status_count}, %{})
|
:telemetry.execute([:pleroma, :local_statuses], %{total: stats.status_count}, %{})
|
||||||
|
:telemetry.execute([:pleroma, :remote_users], %{total: stats.remote_user_count}, %{})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
{
|
|
||||||
"files": { },
|
|
||||||
"pack": {
|
|
||||||
"description": "Dump pack", "homepage": "https://pleroma.social",
|
|
||||||
"license": "Test license", "share-files": true
|
|
||||||
}}
|
|
|
@ -66,4 +66,11 @@ test "receive_timeout should be overridden by :http, :receive_timeout" do
|
||||||
assert options[:receive_timeout] == 20_000
|
assert options[:receive_timeout] == 20_000
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "pool size settings" do
|
||||||
|
test "should get set" do
|
||||||
|
options = AdapterHelper.add_pool_size([], 50)
|
||||||
|
assert options[:pools][:default][:size] == 50
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue