diff options
author | 2024-06-11 11:54:59 +0200 | |
---|---|---|
committer | 2024-06-11 11:54:59 +0200 | |
commit | 611f9de39b7a29e89616c9ffe76d2aca1194877b (patch) | |
tree | c5792f5c4c21070b608e0bb3b743edffbd190074 /internal/db/account.go | |
parent | [bugfix] boost and account recursion (#2982) (diff) | |
download | gotosocial-611f9de39b7a29e89616c9ffe76d2aca1194877b.tar.xz |
[bugfix] Deref stats async, serve stub collections if handshaking (#2990)v0.16.0-rc2
* [bugfix] Deref stats async, allow peek if handshaking
* don't return totalItems when handshaking or hiding collections
* use GetLimit()
* use StubAccountStats
Diffstat (limited to 'internal/db/account.go')
-rw-r--r-- | internal/db/account.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/internal/db/account.go b/internal/db/account.go index 4f02a4d29..45a4ccc09 100644 --- a/internal/db/account.go +++ b/internal/db/account.go @@ -140,10 +140,23 @@ type Account interface { // Update local account settings. UpdateAccountSettings(ctx context.Context, settings *gtsmodel.AccountSettings, columns ...string) error - // PopulateAccountStats gets (or creates and gets) account stats for - // the given account, and attaches them to the account model. + // PopulateAccountStats either creates account stats for the given + // account by performing COUNT(*) database queries, or retrieves + // existing stats from the database, and attaches stats to account. + // + // If account is local and stats were last regenerated > 48 hours ago, + // stats will always be regenerated using COUNT(*) queries, to prevent drift. PopulateAccountStats(ctx context.Context, account *gtsmodel.Account) error + // StubAccountStats creates zeroed account stats for the given account, + // skipping COUNT(*) queries, upserts them in the DB, and attaches them + // to the account model. + // + // Useful following fresh dereference of a remote account, or fresh + // creation of a local account, when you know all COUNT(*) queries + // would return 0 anyway. + StubAccountStats(ctx context.Context, account *gtsmodel.Account) error + // RegenerateAccountStats creates, upserts, and returns stats // for the given account, and attaches them to the account model. // |