seed mrand
This commit is contained in:
parent
2ef1aa89f4
commit
4a87764cca
|
@ -91,7 +91,7 @@ func (n *testNode) GetWhisper(_ interface{}) (types.Whisper, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *testNode) PeersCount() int {
|
||||
func (n *testNode) PeersCount() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
|
|
@ -319,6 +319,7 @@ func (c *Client) pickDefaultServers(servers []*ecdsa.PublicKey) []*ecdsa.PublicK
|
|||
// shuffle and pick n at random
|
||||
shuffledServers := make([]*ecdsa.PublicKey, len(servers))
|
||||
copy(shuffledServers, c.config.DefaultServers)
|
||||
mrand.Seed(time.Now().Unix())
|
||||
mrand.Shuffle(len(shuffledServers), func(i, j int) {
|
||||
shuffledServers[i], shuffledServers[j] = shuffledServers[j], shuffledServers[i]
|
||||
})
|
||||
|
@ -1151,6 +1152,7 @@ func (c *Client) sendNotification(publicKey *ecdsa.PublicKey, installationIDs []
|
|||
// NOTE: here's is a tradeoff, ideally we want to randomly pick a server,
|
||||
// but hit the same servers for batched notifications, for now naively
|
||||
// hit a random server
|
||||
mrand.Seed(time.Now().Unix())
|
||||
mrand.Shuffle(len(info), func(i, j int) {
|
||||
info[i], info[j] = info[j], info[i]
|
||||
})
|
||||
|
|
|
@ -28,6 +28,10 @@ func (w *TestNodeWrapper) GetWaku(_ interface{}) (types.Waku, error) {
|
|||
return w.waku, nil
|
||||
}
|
||||
|
||||
func (w *TestNodeWrapper) PeersCount() int {
|
||||
return 1
|
||||
}
|
||||
|
||||
func (w *TestNodeWrapper) AddPeer(url string) error {
|
||||
panic("not implemented")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue