mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-15 19:47:29 -06:00
[chore] local instance count query caching, improved status context endpoint logging, don't log ErrHideStatus when timelining (#3330)
* ensure that errors checking status visibility / converting aren't dropped * add some more context to error messages * include calling function name in log entries * don't error on timelining hidden status * further code to ignore statusfilter.ErrHideStatus type errors * remove unused error type * add local instance status / domain / user counts * add checks for localhost * rename from InstanceCounts to LocalInstance * improved code comment
This commit is contained in:
parent
964262b169
commit
4592e29087
9 changed files with 214 additions and 91 deletions
17
internal/cache/db.go
vendored
17
internal/cache/db.go
vendored
|
|
@ -18,6 +18,8 @@
|
|||
package cache
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
|
||||
"codeberg.org/gruf/go-structr"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/cache/domain"
|
||||
"github.com/superseriousbusiness/gotosocial/internal/config"
|
||||
|
|
@ -136,6 +138,14 @@ type DBCaches struct {
|
|||
// Instance provides access to the gtsmodel Instance database cache.
|
||||
Instance StructCache[*gtsmodel.Instance]
|
||||
|
||||
// LocalInstance provides caching for
|
||||
// simple + common local instance queries.
|
||||
LocalInstance struct {
|
||||
Domains atomic.Pointer[int]
|
||||
Statuses atomic.Pointer[int]
|
||||
Users atomic.Pointer[int]
|
||||
}
|
||||
|
||||
// InteractionRequest provides access to the gtsmodel InteractionRequest database cache.
|
||||
InteractionRequest StructCache[*gtsmodel.InteractionRequest]
|
||||
|
||||
|
|
@ -849,9 +859,10 @@ func (c *Caches) initInstance() {
|
|||
{Fields: "ID"},
|
||||
{Fields: "Domain"},
|
||||
},
|
||||
MaxSize: cap,
|
||||
IgnoreErr: ignoreErrors,
|
||||
Copy: copyF,
|
||||
MaxSize: cap,
|
||||
IgnoreErr: ignoreErrors,
|
||||
Copy: copyF,
|
||||
Invalidate: c.OnInvalidateInstance,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue