Update event names
This commit is contained in:
@@ -170,7 +170,6 @@ func (p *pwd) InstanceDelete(session *types.Session, instance *types.Instance) e
|
||||
conn := getInstanceTermConn(session.Id, instance.Name)
|
||||
if conn != nil {
|
||||
conn.Close()
|
||||
delete(terms[instance.SessionId], instance.Name)
|
||||
}
|
||||
err := p.docker.DeleteContainer(instance.Name)
|
||||
if err != nil && !strings.Contains(err.Error(), "No such container") {
|
||||
@@ -180,7 +179,6 @@ func (p *pwd) InstanceDelete(session *types.Session, instance *types.Instance) e
|
||||
|
||||
p.event.Emit(event.INSTANCE_DELETE, session.Id, instance.Name)
|
||||
|
||||
delete(session.Instances, instance.Name)
|
||||
if err := p.storage.InstanceDelete(session.Id, instance.Name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/play-with-docker/play-with-docker/docker"
|
||||
"github.com/play-with-docker/play-with-docker/event"
|
||||
"github.com/play-with-docker/play-with-docker/pwd/types"
|
||||
"github.com/twinj/uuid"
|
||||
"github.com/rs/xid"
|
||||
)
|
||||
|
||||
var preparedSessions = map[string]bool{}
|
||||
@@ -44,7 +44,7 @@ func (p *pwd) SessionNew(duration time.Duration, stack, stackName, imageName str
|
||||
defer observeAction("SessionNew", time.Now())
|
||||
|
||||
s := &types.Session{}
|
||||
s.Id = uuid.NewV4().String()
|
||||
s.Id = xid.New().String()
|
||||
s.Instances = map[string]*types.Instance{}
|
||||
s.CreatedAt = time.Now()
|
||||
s.ExpiresAt = s.CreatedAt.Add(duration)
|
||||
@@ -186,7 +186,12 @@ func (p *pwd) SessionDeployStack(s *types.Session) error {
|
||||
func (p *pwd) SessionGet(sessionId string) *types.Session {
|
||||
defer observeAction("SessionGet", time.Now())
|
||||
|
||||
s, _ := p.storage.SessionGet(sessionId)
|
||||
s, err := p.storage.SessionGet(sessionId)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if _, err := p.prepareSession(s); err != nil {
|
||||
log.Println(err)
|
||||
|
||||
Reference in New Issue
Block a user