Skip to content

Commit

Permalink
Fix exceed rate limit
Browse files Browse the repository at this point in the history
  • Loading branch information
christiankakesa committed Feb 19, 2021
1 parent 3a294b7 commit ecf43ca
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions miner/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,21 @@ func (c *Client) recv() {
})
}(i)
}
case types.TypeMinerHandshakeRejected, types.TypeMinerExceedRate:
case types.TypeMinerHandshakeRejected:
reason := types.PeerRejectedResponse{}
err = json.Unmarshal([]byte(result.Content), &reason)
if err != nil {
log.Error("Can't convert rejected message")
}
log.Fatal("Query rejected: ", reason.Reason)
log.Fatal("Handshake rejected: ", reason.Reason)
case types.TypeMinerExceedRate:
reason := types.PeerRejectedResponse{}
err = json.Unmarshal([]byte(result.Content), &reason)
if err != nil {
log.Error("Can't convert rejected message")
}
log.Warn("Too many queries: ", reason.Reason)
time.Sleep(30 * time.Second)
default:
log.Warnf("Unknonw response type %d: %v", result.Type, result)
}
Expand Down

0 comments on commit ecf43ca

Please sign in to comment.