Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Removed deprecated CloseNotifier
Browse files Browse the repository at this point in the history
  • Loading branch information
vania-pooh committed Feb 18, 2019
1 parent 53b3234 commit 52df8b9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ggr-ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func status(w http.ResponseWriter, r *http.Request) {
ch := make(chan struct{}, limit)
rslt := make(chan *result)
done := make(chan Status)
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithCancel(r.Context())
defer cancel()
go func(ctx context.Context) {
for sum, u := range hosts {
Expand Down Expand Up @@ -113,7 +113,7 @@ func status(w http.ResponseWriter, r *http.Request) {
case s := <-done:
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(s)
case <-w.(http.CloseNotifier).CloseNotify():
case <-r.Context().Done():
}
}

Expand Down
2 changes: 1 addition & 1 deletion ggr-ui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func TestResponseTime(t *testing.T) {

var (
silent = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
<-w.(http.CloseNotifier).CloseNotify()
<-r.Context().Done()
}))
empty = http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, `{"total":1,"used":0,"queued":0,"pending":0,"browsers":{"chrome":{"60.0":{}},"firefox":{"59.0":{}}}}`)
Expand Down

0 comments on commit 52df8b9

Please sign in to comment.