1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-10-04 17:33:21 +08:00

Show alert if more than 5 instances are created

This commit is contained in:
Marcos Lilljedahl
2016-10-08 10:52:52 +02:00
parent 62936fcfc9
commit a0ffe28be9
3 changed files with 23 additions and 4 deletions

View File

@@ -13,6 +13,12 @@ func NewInstance(rw http.ResponseWriter, req *http.Request) {
sessionId := bone.GetValue(req, "sessionId")
s := services.GetSession(sessionId)
if len(s.Instances) >= 5 {
rw.WriteHeader(http.StatusConflict)
return
}
i, err := services.NewInstance(s)
if err != nil {
log.Println(err)