mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 12:52:27 -05:00
[performance] remove last of relational queries to instead rely on caches (#2091)
This commit is contained in:
parent
9770d54237
commit
91cbcd589e
19 changed files with 507 additions and 107 deletions
45
internal/cache/size.go
vendored
45
internal/cache/size.go
vendored
|
|
@ -155,6 +155,7 @@ func totalOfRatios() float64 {
|
|||
return 0 +
|
||||
config.GetCacheAccountMemRatio() +
|
||||
config.GetCacheAccountNoteMemRatio() +
|
||||
config.GetCacheApplicationMemRatio() +
|
||||
config.GetCacheBlockMemRatio() +
|
||||
config.GetCacheBlockIDsMemRatio() +
|
||||
config.GetCacheBoostOfIDsMemRatio() +
|
||||
|
|
@ -217,7 +218,7 @@ func sizeofAccount() uintptr {
|
|||
SilencedAt: time.Now(),
|
||||
SuspendedAt: time.Now(),
|
||||
HideCollections: func() *bool { ok := true; return &ok }(),
|
||||
SuspensionOrigin: "",
|
||||
SuspensionOrigin: exampleID,
|
||||
EnableRSS: func() *bool { ok := true; return &ok }(),
|
||||
}))
|
||||
}
|
||||
|
|
@ -231,6 +232,20 @@ func sizeofAccountNote() uintptr {
|
|||
}))
|
||||
}
|
||||
|
||||
func sizeofApplication() uintptr {
|
||||
return uintptr(size.Of(>smodel.Application{
|
||||
ID: exampleID,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
Name: exampleUsername,
|
||||
Website: exampleURI,
|
||||
RedirectURI: exampleURI,
|
||||
ClientID: exampleID,
|
||||
ClientSecret: exampleID,
|
||||
Scopes: exampleTextSmall,
|
||||
}))
|
||||
}
|
||||
|
||||
func sizeofBlock() uintptr {
|
||||
return uintptr(size.Of(>smodel.Block{
|
||||
ID: exampleID,
|
||||
|
|
@ -500,5 +515,31 @@ func sizeofVisibility() uintptr {
|
|||
}
|
||||
|
||||
func sizeofUser() uintptr {
|
||||
return uintptr(size.Of(>smodel.User{}))
|
||||
return uintptr(size.Of(>smodel.User{
|
||||
ID: exampleID,
|
||||
CreatedAt: time.Now(),
|
||||
UpdatedAt: time.Now(),
|
||||
Email: exampleURI,
|
||||
AccountID: exampleID,
|
||||
EncryptedPassword: exampleTextSmall,
|
||||
CurrentSignInAt: time.Now(),
|
||||
LastSignInAt: time.Now(),
|
||||
InviteID: exampleID,
|
||||
ChosenLanguages: []string{"en", "fr", "jp"},
|
||||
FilteredLanguages: []string{"en", "fr", "jp"},
|
||||
Locale: "en",
|
||||
CreatedByApplicationID: exampleID,
|
||||
LastEmailedAt: time.Now(),
|
||||
ConfirmationToken: exampleTextSmall,
|
||||
ConfirmationSentAt: time.Now(),
|
||||
ConfirmedAt: time.Now(),
|
||||
UnconfirmedEmail: exampleURI,
|
||||
Moderator: func() *bool { ok := true; return &ok }(),
|
||||
Admin: func() *bool { ok := true; return &ok }(),
|
||||
Disabled: func() *bool { ok := true; return &ok }(),
|
||||
Approved: func() *bool { ok := true; return &ok }(),
|
||||
ResetPasswordToken: exampleTextSmall,
|
||||
ResetPasswordSentAt: time.Now(),
|
||||
ExternalID: exampleID,
|
||||
}))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue