Unclear why this would happen, but apparently it does?
This commit is contained in:
@@ -402,6 +402,9 @@ func (s *service) Serve(ctx context.Context) error {
|
|||||||
// care about we log ourselves from the handlers.
|
// care about we log ourselves from the handlers.
|
||||||
ErrorLog: log.New(io.Discard, "", 0),
|
ErrorLog: log.New(io.Discard, "", 0),
|
||||||
}
|
}
|
||||||
|
if shouldDebugHTTP() {
|
||||||
|
srv.ErrorLog = log.Default()
|
||||||
|
}
|
||||||
|
|
||||||
l.Infoln("GUI and API listening on", listener.Addr())
|
l.Infoln("GUI and API listening on", listener.Addr())
|
||||||
l.Infoln("Access the GUI via the following URL:", guiCfg.URL())
|
l.Infoln("Access the GUI via the following URL:", guiCfg.URL())
|
||||||
|
|||||||
@@ -36,11 +36,12 @@ type tokenManager struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func newTokenManager(key string, miscDB *db.NamespacedKV, lifetime time.Duration, maxItems int) *tokenManager {
|
func newTokenManager(key string, miscDB *db.NamespacedKV, lifetime time.Duration, maxItems int) *tokenManager {
|
||||||
tokens := &apiproto.TokenSet{
|
var tokens apiproto.TokenSet
|
||||||
Tokens: make(map[string]int64),
|
|
||||||
}
|
|
||||||
if bs, ok, _ := miscDB.Bytes(key); ok {
|
if bs, ok, _ := miscDB.Bytes(key); ok {
|
||||||
_ = proto.Unmarshal(bs, tokens) // best effort
|
_ = proto.Unmarshal(bs, &tokens) // best effort
|
||||||
|
}
|
||||||
|
if tokens.Tokens == nil {
|
||||||
|
tokens.Tokens = make(map[string]int64)
|
||||||
}
|
}
|
||||||
return &tokenManager{
|
return &tokenManager{
|
||||||
key: key,
|
key: key,
|
||||||
@@ -49,7 +50,7 @@ func newTokenManager(key string, miscDB *db.NamespacedKV, lifetime time.Duration
|
|||||||
maxItems: maxItems,
|
maxItems: maxItems,
|
||||||
timeNow: time.Now,
|
timeNow: time.Now,
|
||||||
mut: sync.NewMutex(),
|
mut: sync.NewMutex(),
|
||||||
tokens: tokens,
|
tokens: &tokens,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user