summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2024-03-07 14:05:49 +0100
committermarcin mikołajczak <git@mkljczk.pl>2024-03-07 16:03:40 +0100
commit03d4e7eeccc7fc69c731ada8a7bd049ad52a9d6f (patch)
tree07e0453f5e5422f970cc869b05cf1d44b355abd9 /lib
parenta6e066a77d5ce65b034cd62775614d5902d29d85 (diff)
parent8298b326a7a3081be262c73f734dfe3082962e83 (diff)
downloadpleroma-03d4e7eeccc7fc69c731ada8a7bd049ad52a9d6f.tar.gz
pleroma-03d4e7eeccc7fc69c731ada8a7bd049ad52a9d6f.zip
Merge remote-tracking branch 'origin/develop' into post-languages
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/gun/connection_pool/worker_supervisor.ex4
-rw-r--r--lib/pleroma/web/activity_pub/publisher.ex4
-rw-r--r--lib/pleroma/web/mastodon_api/views/instance_view.ex20
-rw-r--r--lib/pleroma/workers/remote_fetcher_worker.ex7
4 files changed, 27 insertions, 8 deletions
diff --git a/lib/pleroma/gun/connection_pool/worker_supervisor.ex b/lib/pleroma/gun/connection_pool/worker_supervisor.ex
index 24ad61117..eb83962d8 100644
--- a/lib/pleroma/gun/connection_pool/worker_supervisor.ex
+++ b/lib/pleroma/gun/connection_pool/worker_supervisor.ex
@@ -18,10 +18,10 @@ defmodule Pleroma.Gun.ConnectionPool.WorkerSupervisor do
)
end
- def start_worker(opts, retry \\ false) do
+ def start_worker(opts, last_attempt \\ false) do
case DynamicSupervisor.start_child(__MODULE__, {Pleroma.Gun.ConnectionPool.Worker, opts}) do
{:error, :max_children} ->
- funs = [fn -> !retry end, fn -> match?(:error, free_pool()) end]
+ funs = [fn -> last_attempt end, fn -> match?(:error, free_pool()) end]
if Enum.any?(funs, fn fun -> fun.() end) do
:telemetry.execute([:pleroma, :connection_pool, :provision_failure], %{opts: opts})
diff --git a/lib/pleroma/web/activity_pub/publisher.ex b/lib/pleroma/web/activity_pub/publisher.ex
index c27612697..9e7d00519 100644
--- a/lib/pleroma/web/activity_pub/publisher.ex
+++ b/lib/pleroma/web/activity_pub/publisher.ex
@@ -129,6 +129,10 @@ defmodule Pleroma.Web.ActivityPub.Publisher do
_ -> {:error, e}
end
+ {:error, :pool_full} ->
+ Logger.debug("Publisher snoozing worker job due to full connection pool")
+ {:snooze, 30}
+
e ->
unless params[:unreachable_since], do: Instances.set_unreachable(inbox)
Logger.metadata(activity: id, inbox: inbox)
diff --git a/lib/pleroma/web/mastodon_api/views/instance_view.ex b/lib/pleroma/web/mastodon_api/views/instance_view.ex
index 7f73917d6..e4c6c81e1 100644
--- a/lib/pleroma/web/mastodon_api/views/instance_view.ex
+++ b/lib/pleroma/web/mastodon_api/views/instance_view.ex
@@ -63,7 +63,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
registrations: %{
enabled: Keyword.get(instance, :registrations_open),
approval_required: Keyword.get(instance, :account_approval_required),
- message: nil
+ message: nil,
+ url: nil
},
contact: %{
email: Keyword.get(instance, :email),
@@ -78,7 +79,8 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
%{
title: Keyword.get(instance, :name),
version: "#{@mastodon_api_level} (compatible; #{Pleroma.Application.named_version()})",
- languages: Keyword.get(instance, :languages, ["en"])
+ languages: Keyword.get(instance, :languages, ["en"]),
+ rules: []
}
end
@@ -170,13 +172,17 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
defp configuration do
%{
+ accounts: %{
+ max_featured_tags: 0
+ },
statuses: %{
max_characters: Config.get([:instance, :limit]),
max_media_attachments: Config.get([:instance, :max_media_attachments])
},
media_attachments: %{
image_size_limit: Config.get([:instance, :upload_limit]),
- video_size_limit: Config.get([:instance, :upload_limit])
+ video_size_limit: Config.get([:instance, :upload_limit]),
+ supported_mime_types: ["application/octet-stream"]
},
polls: %{
max_options: Config.get([:instance, :poll_limits, :max_options]),
@@ -190,7 +196,13 @@ defmodule Pleroma.Web.MastodonAPI.InstanceView do
defp configuration2 do
configuration()
|> Map.merge(%{
- urls: %{streaming: Pleroma.Web.Endpoint.websocket_url()}
+ urls: %{
+ streaming: Pleroma.Web.Endpoint.websocket_url(),
+ status: Config.get([:instance, :status_page])
+ },
+ vapid: %{
+ public_key: Keyword.get(Pleroma.Web.Push.vapid_config(), :public_key)
+ }
})
end
diff --git a/lib/pleroma/workers/remote_fetcher_worker.ex b/lib/pleroma/workers/remote_fetcher_worker.ex
index d526a99cb..c26418483 100644
--- a/lib/pleroma/workers/remote_fetcher_worker.ex
+++ b/lib/pleroma/workers/remote_fetcher_worker.ex
@@ -22,8 +22,11 @@ defmodule Pleroma.Workers.RemoteFetcherWorker do
{:error, :allowed_depth} ->
{:discard, :allowed_depth}
- _ ->
- :error
+ {:error, _} = e ->
+ e
+
+ e ->
+ {:error, e}
end
end