Fix three bugs in the reload handler identified in #5103:
1. Use a buffered error channel (size 1) so the reloader goroutine
never blocks if the HTTP client disconnects before reading the
result.
2. Remove the incorrect `defer close(errc)` — the handler is the
receiver, not the sender; closing from the receiver side could
panic the sender.
3. Wrap both the enqueue (send to reloadCh) and the reply (receive
from errc) in select statements that also listen on
req.Context().Done(), so a client disconnect unblocks the handler
at either stage.
Fixes#5103
Signed-off-by: June Kim <kimjune01@gmail.com>
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>
In the future, we want to remove the ui build artifacts from the
repository. This will break the usages of
```sh
go get github.com/prometheus/alertmanager/ui
```
That is exactly as expected, since the ui can't function correctly
without the ui artefacts.
This change attempts to make the transition a bit less painful.
Signed-off-by: Solomon Jacobs <solomonjacobs@protonmail.com>