You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Go 1.15 behavior of http.Server.Shutdown changed and now server waits for all listeners to disconnect.
// go/1.15/libexec/src/net/http/server.go:2699...ticker:=time.NewTicker(shutdownPollInterval) // 500 msdeferticker.Stop()
for {
ifsrv.closeIdleConns() &&srv.numListeners() ==0 { // for some reason this is always false first timereturnlnerr
}
select {
case<-ctx.Done():
returnctx.Err()
case<-ticker.C: // we always wait here half a second
}
...
For some reason, on mock shutdown we always still have some active connections and shutdown takes about 500ms. And since we shutdown all mocks synchronously with a lot of mocks we wait for tests to finish for up to 18 seconds.
Does anyone else have this issue?
As a solution we can close each mock server in a separate goroutine, that should reduce wait time for us from 18s to 500ms.
The text was updated successfully, but these errors were encountered:
Suggested solution looks more like a work around. I'd better find out why it can't be shut down immediately as I don't see any reason to wait even 500 ms.
In Go 1.15 behavior of http.Server.Shutdown changed and now server waits for all listeners to disconnect.
For some reason, on mock shutdown we always still have some active connections and shutdown takes about 500ms. And since we shutdown all mocks synchronously with a lot of mocks we wait for tests to finish for up to 18 seconds.
Does anyone else have this issue?
As a solution we can close each mock server in a separate goroutine, that should reduce wait time for us from 18s to 500ms.
The text was updated successfully, but these errors were encountered: