mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Use consul/lib's RandomStagger
Removes four redundant copies of the method in the process.
This commit is contained in:
@@ -2,16 +2,9 @@ package agent
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Returns a random stagger interval between 0 and the duration
|
||||
func randomStagger(intv time.Duration) time.Duration {
|
||||
return time.Duration(uint64(rand.Int63()) % uint64(intv))
|
||||
}
|
||||
|
||||
// IpOfDevice returns a routable ip addr of a device
|
||||
func ipOfDevice(name string) (net.IP, error) {
|
||||
intf, err := net.InterfaceByName(name)
|
||||
|
||||
Reference in New Issue
Block a user