mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-15 06:43:03 -06:00
[feature] Process Reject of interaction via fedi API, put rejected statuses in the "sin bin" 😈 (#3271)
* [feature] Process `Reject` of interaction via fedi API, put rejected statuses in the "sin bin" * update test * move nil check back to `rejectStatusIRI`
This commit is contained in:
parent
3254ef1923
commit
307d98e386
21 changed files with 1172 additions and 115 deletions
29
internal/cache/db.go
vendored
29
internal/cache/db.go
vendored
|
|
@ -145,6 +145,9 @@ type DBCaches struct {
|
|||
// Report provides access to the gtsmodel Report database cache.
|
||||
Report StructCache[*gtsmodel.Report]
|
||||
|
||||
// SinBinStatus provides access to the gtsmodel SinBinStatus database cache.
|
||||
SinBinStatus StructCache[*gtsmodel.SinBinStatus]
|
||||
|
||||
// Status provides access to the gtsmodel Status database cache.
|
||||
Status StructCache[*gtsmodel.Status]
|
||||
|
||||
|
|
@ -1170,6 +1173,32 @@ func (c *Caches) initReport() {
|
|||
})
|
||||
}
|
||||
|
||||
func (c *Caches) initSinBinStatus() {
|
||||
// Calculate maximum cache size.
|
||||
cap := calculateResultCacheMax(
|
||||
sizeofSinBinStatus(), // model in-mem size.
|
||||
config.GetCacheSinBinStatusMemRatio(),
|
||||
)
|
||||
|
||||
log.Infof(nil, "cache size = %d", cap)
|
||||
|
||||
copyF := func(s1 *gtsmodel.SinBinStatus) *gtsmodel.SinBinStatus {
|
||||
s2 := new(gtsmodel.SinBinStatus)
|
||||
*s2 = *s1
|
||||
return s2
|
||||
}
|
||||
|
||||
c.DB.SinBinStatus.Init(structr.CacheConfig[*gtsmodel.SinBinStatus]{
|
||||
Indices: []structr.IndexConfig{
|
||||
{Fields: "ID"},
|
||||
{Fields: "URI"},
|
||||
},
|
||||
MaxSize: cap,
|
||||
IgnoreErr: ignoreErrors,
|
||||
Copy: copyF,
|
||||
})
|
||||
}
|
||||
|
||||
func (c *Caches) initStatus() {
|
||||
// Calculate maximum cache size.
|
||||
cap := calculateResultCacheMax(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue