Skip to content

Commit

Permalink
Reconnection will always be needed here!
Browse files Browse the repository at this point in the history
  • Loading branch information
stut committed May 26, 2024
1 parent 9561470 commit e8e11b9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/v2/distributor/downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ func NewDownstream(addr string) *Downstream {
func (ds *Downstream) Run() {
var err error
for {
// Reconnect if necessary
if ds.conn == nil {
slog.Info("Connecting to downstream server", "addr", ds.addr)
u := url.URL{Scheme: "ws", Host: ds.addr, Path: "/ws"}
ds.conn, _, err = websocket.DefaultDialer.Dial(u.String(), nil)
assert.NoError(err, "unable to connect to downstream server "+ds.addr)
}
slog.Info("Connecting to downstream server", "addr", ds.addr)
u := url.URL{Scheme: "ws", Host: ds.addr, Path: "/ws"}
ds.conn, _, err = websocket.DefaultDialer.Dial(u.String(), nil)
assert.NoError(err, "unable to connect to downstream server "+ds.addr)

for {
// Discard any incoming messages
Expand Down

0 comments on commit e8e11b9

Please sign in to comment.