Some questions about ActivityPub implementation

Imported from Github #344

I have some questions about ActivityPub implementation.

  1. When fetching a remote account for the first time, should I get its outbox manually? So when a user from my server starts following it, the posts from this account would appear in this user’s timeline automatically.
  2. Should I fetch a remote account’s information (e.g. profile picture) and its outbox everytime when a user views this account from my server?
  3. How can I deal when a user has too many remote followers (for example 50) and makes a new post? I think sending 50 requests at a time is not very rational.
  1. You can if you want to. Or you can simply wait for delivery of new activities. Some implementations may not persist activities in the outbox, e.g. if they only use transient delivery.
  2. You could, but that might be wasteful. You should consider caching profiles, because in practice they don’t change often.
  3. If remote followers are on the same server, you might be able to use the sharedInbox endpoint if it is supported by that remote software.

There’s nothing in the ActivityPub spec that requires or forbids this

There’s nothing in the ActivityPub spec that requires or forbids this.

You’re going to have to deliver the posts somehow, unless you want to compromise on correctness or speed. (Although note that, as @trwnh mentions, you only have to care about the number of unique servers among your user’s remote followers, because you only have to delivery once per unique sharedInbox endpoint). But I wouldn’t worry too much—mastodon makes thousands of outgoing delivery requests per second and it’s not even written in a particularly performant language.

1.) from a users perspective I would recommend it

A real world example from a friend :
You start a conference and do photos.
You create a new photoservice account just for the photos.
Now the users start looking at the account in mastodon but the timeline is blank.
They can only wait for the next conference then :wink: