hyphacoop / social.distributed.press

A Social Inbox for Decentralized Publishing and ActivityPub.
https://hypha.coop/dripline/announcing-dp-social-inbox/
GNU Affero General Public License v3.0
23 stars 3 forks source link

Too many fetches #55

Open fauno opened 6 months ago

fauno commented 6 months ago

I added console.log to signedFetch() and mentionToActor. When performing an approval action for a single activity, I see all of these requests logged.

https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
fetchhttps://skel.sutty.local/about.jsonld#main-key
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://skel.sutty.local/about.jsonld#main-key
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://skel.sutty.local/about.jsonld
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://fedi.sutty.nl/users/fauno
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://fedi.sutty.nl/users/fauno/inbox
https://skel.sutty.local/.well-known/webfinger?resource=acct:skel@skel.sutty.local
https://fedi.sutty.nl/users/fauno
RangerMauve commented 6 months ago

Yeah we really need a caching layer with a TTL.

fauno commented 5 months ago

Nice to have by the end of M4 if we can, but low priority.

RangerMauve commented 3 months ago

This could be used to replace the default fetch: https://www.npmjs.com/package/node-fetch-cache

We should use the storage location via the fs.

We should also have a large TTL, maybe a few hours at least? Even a day?

fauno commented 3 months ago

We should also have a large TTL, maybe a few hours at least? Even a day?

from what i've seen so far while developing caching on the side of the jekyll plugin, mastodon goes a good job at caching (it uses rails), so letting the caching library follow the remote instance headers for ttls should be ok