Remove session lock as it's worthless now that PWD is deployed in (#204)
multiple servers
This commit is contained in:
committed by
Jonathan Leibiusky
parent
80fcf5abe3
commit
2cbde6d067
@@ -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) {
|
func (p *pwd) InstanceNew(session *types.Session, conf types.InstanceConfig) (*types.Instance, error) {
|
||||||
defer observeAction("InstanceNew", time.Now())
|
defer observeAction("InstanceNew", time.Now())
|
||||||
session.Lock()
|
|
||||||
defer session.Unlock()
|
|
||||||
|
|
||||||
instances, err := p.storage.InstanceFindBySessionId(session.Id)
|
instances, err := p.storage.InstanceFindBySessionId(session.Id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,28 +1,18 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
Id string `json:"id" bson:"id"`
|
Id string `json:"id" bson:"id"`
|
||||||
CreatedAt time.Time `json:"created_at" bson:"created_at"`
|
CreatedAt time.Time `json:"created_at" bson:"created_at"`
|
||||||
ExpiresAt time.Time `json:"expires_at" bson:"expires_at"`
|
ExpiresAt time.Time `json:"expires_at" bson:"expires_at"`
|
||||||
PwdIpAddress string `json:"pwd_ip_address" bson:"pwd_ip_address"`
|
PwdIpAddress string `json:"pwd_ip_address" bson:"pwd_ip_address"`
|
||||||
Ready bool `json:"ready" bson:"ready"`
|
Ready bool `json:"ready" bson:"ready"`
|
||||||
Stack string `json:"stack" bson:"stack"`
|
Stack string `json:"stack" bson:"stack"`
|
||||||
StackName string `json:"stack_name" bson:"stack_name"`
|
StackName string `json:"stack_name" bson:"stack_name"`
|
||||||
ImageName string `json:"image_name" bson:"image_name"`
|
ImageName string `json:"image_name" bson:"image_name"`
|
||||||
Host string `json:"host" bson:"host"`
|
Host string `json:"host" bson:"host"`
|
||||||
UserId string `json:"user_id" bson:"user_id"`
|
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()
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user