Lock when creating new sessions as access to session map cannot happen

concurrently
This commit is contained in:
Jonathan Leibiusky @xetorthio
2017-06-12 12:59:34 -03:00
parent e09ac22579
commit 37c16d0d98
2 changed files with 5 additions and 0 deletions

View File

@@ -52,6 +52,9 @@ type Session struct {
}
func (p *pwd) SessionNew(duration time.Duration, stack, stackName string) (*Session, error) {
sessionsMutex.Lock()
defer sessionsMutex.Unlock()
s := &Session{}
s.Id = uuid.NewV4().String()
s.Instances = map[string]*Instance{}