Skip to content

Commit

Permalink
Adds error channel for events
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 committed Nov 27, 2018
1 parent 9d2bdb6 commit 57ad1b9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func streamEvents(w http.ResponseWriter, r *http.Request) {

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
messages, _ := dockerClient.Events(ctx)
messages, error := dockerClient.Events(ctx)

Loop:
for {
Expand Down Expand Up @@ -195,6 +195,9 @@ Loop:
case <-r.Context().Done():
cancel()
break Loop
case <-error:
cancel()
break Loop
}
}
}

0 comments on commit 57ad1b9

Please sign in to comment.