Move max instnace check to playground config
This commit is contained in:
@@ -38,6 +38,20 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
instances, err := core.InstanceFindBySession(s)
|
||||
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
rw.WriteHeader(http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
if playground.InstancesMax > 0 && len(instances) > playground.MaxInstances {
|
||||
log.Println(err)
|
||||
rw.WriteHeader(http.StatusConflict)
|
||||
return
|
||||
}
|
||||
|
||||
i, err := core.InstanceNew(s, body)
|
||||
if err != nil {
|
||||
if pwd.SessionComplete(err) {
|
||||
|
||||
Reference in New Issue
Block a user