refactor deliver
to extract actor from activity #377
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor-deliver-actor"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Instead of explicitly stating the actor user ID in the deliver queue which can lead to desynchronization the actor to be used for signing should be extracted directly from the activity to be delivered.
We can be sure that there will always be an actor URI since anything we deliver will have to be an Activity (in the ActivityPub sense).
b5cf4540c3
toc66420c125
@ -21,0 +22,4 @@
// get user/actor for signing
const userUri = job.data.content.actor;
if (userUri == null) return 'error: missing actor';
const user = await uriPersonCache.fetch(userUri);
Could it be possible that
user
might be wrong or null?Also, do all activity classes/structs/objects have an actor field?
Additionally, there are no checks to make sure the user is local; though it shouldn't be a problem, but would fail later in case of a bug somewhere else.
If a user cannot be found by the URI (and thus
user == null
), the activity must be malformed and it would be proper to fail and not deliver the malformed activity.Since only local users have private keys stored in the database, a request in the name of a remote actor would fail at the point of trying to sign the activity.
I think it is a good idea to make these two things explicit.
As I noted above, anything that we can deliver must be an (ActivityPub) Activity. I think Activities only make sense if they have an Actor, at least Foundkey can only understand Activities that have an Actor. So I think it is reasonable to also only send activities with an actor, and fail on activities missing an actor.
@ -9,3 +9,1 @@
/** Actor */
user: ThinUser;
/** Activity */
/** Activity, containing the actor URI */
Sounds like a TS typing would be preferable here, considering this field is required?
3b994f14e5
to4683e1a93e
4683e1a93e
to37e76326f7
Refactored from resolving the actor URI on every delivery attempt to instead resolving the actor URI once when creating the queue job. While this does not achieve what I set out above, it still achieves that it is not necessary to explicitly pass the actor to the
deliver
function, which was the ultimate goal of the PR.This change is because some field testing has shown that resolving the actor URI does have a noticeable performance penalty if done on every delivery attempt, and the amount of additional memory that is used in the queue job is negligible, since only the user ID is passed.
The big advantage that this still has is reducing the complexity of calling the
deliver
function.37e76326f7
tob374a79eb1
Pulled in this PR on my instance for testing. will give feedback after a couple of days running it.
I have to revert back this PR on my instance. Impact on the queues are too severe.
inboxJobConcurency
(or whatever its called) just for the inbox queue to be able to keep up somewhatDisk Space gets eaten way more aggressively for some reasonwas something else unrelatedMost of the failed jobs in deliver seem to be timeouts, haven't checked all failed jobs tho
In inbox, i have tons of jobs
job stalled more than allowable limit
and also a couple with accessing a property on undefined
i've also seen some other properties (send some yesterday to @Johann150 )
thats all the infos i can give rn. i wish i had more, but its extremly hard to track down certain jobs and stuff, let alone search for it
ba77a81cc0
to588a5502e9
588a5502e9
toe574d9cef1
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.