Remove session lock as it's worthless now that PWD is deployed in (#204)

multiple servers
This commit is contained in:
Marcos Nils
2017-11-02 14:20:14 -03:00
committed by Jonathan Leibiusky
parent 80fcf5abe3
commit 2cbde6d067
2 changed files with 10 additions and 22 deletions

View File

@@ -97,8 +97,6 @@ func (p *pwd) InstanceDelete(session *types.Session, instance *types.Instance) e
func (p *pwd) InstanceNew(session *types.Session, conf types.InstanceConfig) (*types.Instance, error) {
defer observeAction("InstanceNew", time.Now())
session.Lock()
defer session.Unlock()
instances, err := p.storage.InstanceFindBySessionId(session.Id)
if err != nil {

View File

@@ -1,28 +1,18 @@
package types
import (
"sync"
"time"
)
type Session struct {
Id string `json:"id" bson:"id"`
CreatedAt time.Time `json:"created_at" bson:"created_at"`
ExpiresAt time.Time `json:"expires_at" bson:"expires_at"`
PwdIpAddress string `json:"pwd_ip_address" bson:"pwd_ip_address"`
Ready bool `json:"ready" bson:"ready"`
Stack string `json:"stack" bson:"stack"`
StackName string `json:"stack_name" bson:"stack_name"`
ImageName string `json:"image_name" bson:"image_name"`
Host string `json:"host" bson:"host"`
UserId string `json:"user_id" bson:"user_id"`
rw sync.Mutex `json:"-"`
}
func (s *Session) Lock() {
s.rw.Lock()
}
func (s *Session) Unlock() {
s.rw.Unlock()
Id string `json:"id" bson:"id"`
CreatedAt time.Time `json:"created_at" bson:"created_at"`
ExpiresAt time.Time `json:"expires_at" bson:"expires_at"`
PwdIpAddress string `json:"pwd_ip_address" bson:"pwd_ip_address"`
Ready bool `json:"ready" bson:"ready"`
Stack string `json:"stack" bson:"stack"`
StackName string `json:"stack_name" bson:"stack_name"`
ImageName string `json:"image_name" bson:"image_name"`
Host string `json:"host" bson:"host"`
UserId string `json:"user_id" bson:"user_id"`
}