Skip to content

Commit

Permalink
Avoid burning the CPU.
Browse files Browse the repository at this point in the history
  • Loading branch information
atik-lab committed Jan 27, 2021
1 parent 1213be1 commit 5820df5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions recws/recws.go
Expand Up @@ -377,8 +377,8 @@ func (rc *RecConn) keepAlive() {

for {
if !rc.IsConnected() {
time.Sleep(time.Millisecond * 100) // avoid burning CPU
continue
rc.CloseAndReconnect()
return
}

if err := rc.writeControlPingMessage(); err != nil {
Expand Down

0 comments on commit 5820df5

Please sign in to comment.