unify none keys, explicit nil for failed notifier
This commit is contained in:
@@ -95,7 +95,7 @@ type AvatarGroup struct {
|
||||
|
||||
// CacheGroup defines options group for cache params
|
||||
type CacheGroup struct {
|
||||
Type string `long:"type" env:"TYPE" description:"type of cache" choice:"mem" choice:"mongo" choice:"nop" default:"mem"`
|
||||
Type string `long:"type" env:"TYPE" description:"type of cache" choice:"mem" choice:"mongo" choice:"none" default:"mem"`
|
||||
Max struct {
|
||||
Items int `long:"items" env:"ITEMS" default:"1000" description:"max cached items"`
|
||||
Value int `long:"value" env:"VALUE" default:"65536" description:"max size of cached value"`
|
||||
@@ -229,6 +229,7 @@ func (s *ServerCommand) newServerApp() (*serverApp, error) {
|
||||
notifyService, err := s.makeNotify(dataService)
|
||||
if err != nil {
|
||||
log.Printf("[WARN] failed to make notify service, %s", err)
|
||||
notifyService = nil // disable notifier
|
||||
}
|
||||
|
||||
authProviders := s.makeAuthProviders(jwtService, avatarProxy, dataService)
|
||||
@@ -414,7 +415,7 @@ func (s *ServerCommand) makeCache() (cache.LoadingCache, error) {
|
||||
conn := mongo.NewConnection(mgServer, s.Mongo.DB, "cache")
|
||||
return cache.NewMongoCache(conn, cache.MaxCacheSize(s.Cache.Max.Size), cache.MaxValSize(s.Cache.Max.Value),
|
||||
cache.MaxKeys(s.Cache.Max.Items))
|
||||
case "nop":
|
||||
case "none":
|
||||
return &cache.Nop{}, nil
|
||||
}
|
||||
return nil, errors.Errorf("unsupported cache type %s", s.Cache.Type)
|
||||
|
||||
Reference in New Issue
Block a user