gotosocial icon indicating copy to clipboard operation
gotosocial copied to clipboard

[feature] Fetching remote accounts directly should refresh DB info

Open NyaaaWhatsUpDoc opened this issue 3 years ago • 10 comments

Due to restarting my instance at points I've obviously missed the profile change AP messages at some point so my profile data for multiple people is out of date. Performing a direct fetch of an account, i.e. visiting a user's profile page, should perform the equivalent of GetRemoteStatus(refresh = true) to keep profiles up-to-date

NyaaaWhatsUpDoc avatar Sep 14 '21 06:09 NyaaaWhatsUpDoc

Agree that this is a problem, but I'm not sure if we want to trigger a refresh every time a profile is visited directly, since this could easily end up spamming remote instances. I think it's probably better if we implement something with LastWebfingeredAt on accounts; if an account hasn't been webfingered (ie., refreshed) in say 6 hours (or some other time limit), then a refresh is performed the next time an account is 'seen'. That seems less prone to spam, although the price we pay then is not having minute-to-minute updates of an account if we miss the Update activitypub message.

tsmethurst avatar Sep 14 '21 07:09 tsmethurst

I mean even a 5 minute timeout would prevent spam and would ensure near-enough minute-to-minute updates IMO

NyaaaWhatsUpDoc avatar Sep 14 '21 08:09 NyaaaWhatsUpDoc

Ah yes, so maybe we do a refresh UNLESS lastwebfingered at is within x amount of time? That could work indeed

tsmethurst avatar Sep 14 '21 09:09 tsmethurst

We could do the same for fetching remote statuses in direct-view and their lastmodtime -- which I'm assuming would allow us to keep some kind of an eye of favourites / reblogs count?

NyaaaWhatsUpDoc avatar Sep 14 '21 09:09 NyaaaWhatsUpDoc

Reblog and favourite counts aren't pinned to the activitypub representation of the status, so thankfully we don't need to dereference a status once we've got it already (unless we assume some kind of 'Update' thing, which afaik not many (any?) AP implementations use yet). We just use the amount of reblogs and faves we've seen to generate those numbers :)

tsmethurst avatar Sep 14 '21 09:09 tsmethurst

Ah gotcha that does make things much simpler :)

Would a combo of domain != nil && time.Now().Sub(lastmodtime) > threshold do essentially the same on accounts? I'm just wondering if we need to use the last-webfingered check, as an account update via AP wouldn't update the webfingered time I'm assuming?

NyaaaWhatsUpDoc avatar Sep 14 '21 09:09 NyaaaWhatsUpDoc

an account update via AP wouldn't update the webfingered time I'm assuming

Good point... Maybe we should change that column to 'lastDereferencedAt' and count an Update as a dereference (just one that we're having pushed to us, rather than pulling).

tsmethurst avatar Sep 14 '21 09:09 tsmethurst

Sure a last modified time would serve this purpose? And have the bonus of not being useful only for remote accounts

NyaaaWhatsUpDoc avatar Sep 14 '21 09:09 NyaaaWhatsUpDoc

Mmm yes on reflection I think you're right, maybe we can just drop 'lastWebfingeredAt' altogether then :)

tsmethurst avatar Sep 14 '21 09:09 tsmethurst

Related to #822

tsmethurst avatar Dec 05 '22 10:12 tsmethurst

closed by https://github.com/superseriousbusiness/gotosocial/pull/1411

tsmethurst avatar Feb 17 '23 09:02 tsmethurst