diff options
author | Mark Felder <feld@feld.me> | 2023-12-07 22:27:19 -0500 |
---|---|---|
committer | Mark Felder <feld@feld.me> | 2023-12-08 17:45:20 -0500 |
commit | 074b31d9ab30bbecba3fff4335dfec39af5cf9b8 (patch) | |
tree | 99ebf46c4666cd66b5feb7dd3ccf65f6c8b0c8f9 /test | |
parent | 5f74aadaaf6f8cbd31ce251a03729c8d5276409a (diff) | |
download | pleroma-074b31d9ab30bbecba3fff4335dfec39af5cf9b8.tar.gz pleroma-074b31d9ab30bbecba3fff4335dfec39af5cf9b8.zip |
Optimistic Inbox
Rework inbound federation to accept requests optimistically. The HTTP Signatures Plug will not attempt to fetch the actor or key and will fail early.
If the signature cannot be validated we pass the required data into the Oban job with a reduced priority and increase the timeout to 20 seconds. The Oban job will handle the actor and key fetching before attempting to validate the activity again. This job will be retried 5 times by default.
Another welcome side effect is that actors who change their keys can federate to Pleroma instances immediately instead of needing to wait the default value of 86400s / 24 hours before the key will be fetched again.
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/user_test.exs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/pleroma/user_test.exs b/test/pleroma/user_test.exs index b9df527a0..c0b576c3c 100644 --- a/test/pleroma/user_test.exs +++ b/test/pleroma/user_test.exs @@ -1951,8 +1951,13 @@ defmodule Pleroma.UserTest do end end - test "get_public_key_for_ap_id fetches a user that's not in the db" do - assert {:ok, _key} = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin") + test "get_or_fetch_public_key_for_ap_id fetches a user that's not in the db" do + assert {:ok, _key} = + User.get_or_fetch_public_key_for_ap_id("http://mastodon.example.org/users/admin") + end + + test "get_public_key_for_ap_id returns correctly for user that's not in the db" do + assert :error = User.get_public_key_for_ap_id("http://mastodon.example.org/users/admin") end describe "per-user rich-text filtering" do |