Fix another deadlock
This commit is contained in:
parent
ebaa42f405
commit
4b3d83f2b5
2 changed files with 6 additions and 7 deletions
|
|
@ -947,8 +947,7 @@ CONTINUE:
|
|||
func configureSite(conf map[string]interface{}, loadpoints []*core.Loadpoint, tariffs *tariff.Tariffs) (*core.Site, error) {
|
||||
site, err := core.NewSiteFromConfig(conf)
|
||||
if err != nil {
|
||||
// TODO proper handling
|
||||
panic(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := site.Boot(log, loadpoints, tariffs); err != nil {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
mu sync.Mutex
|
||||
mu sync.RWMutex
|
||||
Subject, Token string
|
||||
ExpiresAt time.Time
|
||||
)
|
||||
|
|
@ -24,14 +24,14 @@ const (
|
|||
)
|
||||
|
||||
func IsAuthorized() bool {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
mu.RLock()
|
||||
defer mu.RUnlock()
|
||||
return len(Subject) > 0
|
||||
}
|
||||
|
||||
func IsAuthorizedForApi() bool {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
mu.RLock()
|
||||
defer mu.RUnlock()
|
||||
return IsAuthorized() && Subject != unavailable && Token != ""
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue