Move max instnace check to playground config
This commit is contained in:
@@ -98,16 +98,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())
|
||||
|
||||
instances, err := p.storage.InstanceFindBySessionId(session.Id)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(instances) >= 5 {
|
||||
return nil, sessionComplete
|
||||
}
|
||||
|
||||
prov, err := p.getProvisioner(conf.Type)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -87,4 +87,5 @@ type Playground struct {
|
||||
FacebookClientSecret string `json:"facebook_client_secret" bson:"facebook_client_secret"`
|
||||
DockerClientID string `json:"docker_client_id" bson:"docker_client_id"`
|
||||
DockerClientSecret string `json:"docker_client_secret" bson:"docker_client_secret"`
|
||||
MaxInstances int `json:"max_instances" bson:"max_instances"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user