aboutsummaryrefslogtreecommitdiff
path: root/http_server.go
diff options
context:
space:
mode:
Diffstat (limited to 'http_server.go')
-rw-r--r--http_server.go18
1 files changed, 11 insertions, 7 deletions
diff --git a/http_server.go b/http_server.go
index 2a01332..8a61ce8 100644
--- a/http_server.go
+++ b/http_server.go
@@ -845,20 +845,21 @@ func (httpd *httpServer) ExecuteTail(sseconn *libhttp.SSEConn) {
}
execRes.mtxOutput.Unlock()
+ var (
+ ok = true
+
+ ev sseclient.Event
+ evid int64
+ )
+
if len(execRes.EndAt) != 0 {
// The execution has been completed.
sseconn.WriteEvent(`end`, execRes.EndAt, nil)
- return
+ goto out
}
// And wait for the rest...
- var (
- ok = true
-
- ev sseclient.Event
- evid int64
- )
for {
ev, ok = <-execRes.eventq
if !ok {
@@ -877,4 +878,7 @@ func (httpd *httpServer) ExecuteTail(sseconn *libhttp.SSEConn) {
}
sseconn.WriteEvent(ev.Type, ev.Data, &ev.ID)
}
+out:
+ delete(httpd.idExecRes, execID)
+ delete(httpd.idContextCancel, execID)
}