Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727fdb9a7d | ||
|
|
5670edb269 |
@@ -9,6 +9,7 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"slices"
|
"slices"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/go-chi/chi/v5/middleware"
|
"github.com/go-chi/chi/v5/middleware"
|
||||||
"sneak.berlin/go/pixa/internal/httpfetcher"
|
"sneak.berlin/go/pixa/internal/httpfetcher"
|
||||||
@@ -101,8 +102,10 @@ func TestImageRoutes_ClientGoneAnswers499(t *testing.T) {
|
|||||||
ctx, http.MethodGet, target, nil))
|
ctx, http.MethodGet, target, nil))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// The fetch is still held, so the second request can end only
|
// Give the second request time to start waiting for the first
|
||||||
// because its client went away
|
// request's image. The fetch is still held, so the second request
|
||||||
|
// can end only because its client went away
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
cancel()
|
cancel()
|
||||||
<-secondDone
|
<-secondDone
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user