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

Commit

Permalink
HTTP cache: don't re-recreate the Listener (#28)
Browse files Browse the repository at this point in the history
This drastically decreases the number of "connection refused" errors
caused by races when the HTTP server in a separate goroutine is not
started, yet the agent already tries to use it.
  • Loading branch information
edigaryev committed Aug 5, 2020
1 parent 347b6cb commit ce4e12f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions internal/http_cache/http_cache.go
Expand Up @@ -27,9 +27,8 @@ func Start(taskIdentification api.TaskIdentification) string {
}
if err == nil {
address = listener.Addr().String()
listener.Close()
log.Printf("Starting http cache server %s\n", address)
go http.ListenAndServe(address, nil)
go http.Serve(listener, nil)
} else {
log.Printf("Failed to start http cache server %s: %s\n", address, err)
}
Expand Down

0 comments on commit ce4e12f

Please sign in to comment.