Skip to content

Commit

Permalink
add reconnect into cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
subsan committed Mar 14, 2023
1 parent d3485bd commit 2707aef
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/connector/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,19 @@ func disconnect() {
}

func reconnect() {
time.Sleep(config.Config.Timeout.Reconnect)
log.Printf(" [ ] [connector] try reconnect")
disconnect()
connect()
for !isConnected {
time.Sleep(config.Config.Timeout.Reconnect)
log.Printf(" [ ] [connector] try reconnect")
disconnect()
connect()
}
}

func Listener(address string) {
connectionAddress = address
connect()

for !isConnected {
if !isConnected {
reconnect()
}

Expand Down

0 comments on commit 2707aef

Please sign in to comment.