1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-10-05 18:03:21 +08:00

Refactor sessions and add locking to avoid concurrent requests to create

more instances
This commit is contained in:
Marcos Lilljedahl
2016-10-14 12:54:25 -03:00
parent d19e8a0cd3
commit a56af3dc22
7 changed files with 21 additions and 26 deletions

View File

@@ -9,10 +9,10 @@ import (
func DeleteInstance(rw http.ResponseWriter, req *http.Request) {
sessionId := bone.GetValue(req, "sessionId")
instanceId := bone.GetValue(req, "instanceId")
instanceName := bone.GetValue(req, "instanceName")
s := services.GetSession(sessionId)
i := services.GetInstance(s, instanceId)
i := services.GetInstance(s, instanceName)
err := services.DeleteInstance(s, i)
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)