added more tuning knobs, particularly in cache sizes

This commit is contained in:
2026-02-20 15:44:06 -07:00
parent d8eeeb7140
commit 8a1c770079
10 changed files with 86 additions and 34 deletions
+8 -3
View File
@@ -16,6 +16,7 @@ import (
"slices"
"sync"
"git.erbosoft.com/amy/amsterdam/config"
lru "github.com/hashicorp/golang-lru"
"github.com/jmoiron/sqlx"
"gopkg.in/yaml.v3"
@@ -91,8 +92,7 @@ var servicesCacheMutex sync.Mutex
// init loads the service configuration and builds all the internal indexes.
func init() {
var err error
if err = yaml.Unmarshal(initServiceData, &serviceRoot); err != nil {
if err := yaml.Unmarshal(initServiceData, &serviceRoot); err != nil {
panic(err) // can't happen
}
serviceRoot.byName = make(map[string]*ServiceDomain)
@@ -118,7 +118,12 @@ func init() {
dom.byId["SysAdmin"].vtable = &empty
dom.byId["Conference"].vtable = &empty // TODO
dom.byId["Members"].vtable = &empty
servicesCache, err = lru.New2Q(50)
}
// setupServicesCache sets up the services cache.
func setupServicesCache() {
var err error
servicesCache, err = lru.New2Q(config.GlobalConfig.Tuning.Caches.Services)
if err != nil {
panic(err)
}