mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
adjust weedc heartbeat to be randomly between (1*pulse, 2*pulse) seconds
git-svn-id: https://weed-fs.googlecode.com/svn/trunk@29 282b0af5-e82d-9cf1-ede4-77906d7719d0
This commit is contained in:
parent
3c98f1a119
commit
b2f4a4e739
|
@ -8,6 +8,7 @@ import (
|
||||||
"json"
|
"json"
|
||||||
"log"
|
"log"
|
||||||
"mime"
|
"mime"
|
||||||
|
"rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -136,7 +137,8 @@ func main() {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
store.Join(*metaServer)
|
store.Join(*metaServer)
|
||||||
time.Sleep(int64(*pulse) * 1e9)
|
ns := int64(*pulse) * 1e9
|
||||||
|
time.Sleep(ns + rand.Int63()%ns)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
log.Println("store joined at", *metaServer)
|
log.Println("store joined at", *metaServer)
|
||||||
|
|
|
@ -43,7 +43,7 @@ func dirJoinHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
publicUrl := r.FormValue("publicUrl")
|
publicUrl := r.FormValue("publicUrl")
|
||||||
volumes := new([]storage.VolumeInfo)
|
volumes := new([]storage.VolumeInfo)
|
||||||
json.Unmarshal([]byte(r.FormValue("volumes")), volumes)
|
json.Unmarshal([]byte(r.FormValue("volumes")), volumes)
|
||||||
log.Println("Recieved updates from", s, "volumes", r.FormValue("volumes"))
|
log.Println(s, "volumes", r.FormValue("volumes"))
|
||||||
mapper.Add(*directory.NewMachine(s, publicUrl, *volumes))
|
mapper.Add(*directory.NewMachine(s, publicUrl, *volumes))
|
||||||
}
|
}
|
||||||
func dirStatusHandler(w http.ResponseWriter, r *http.Request) {
|
func dirStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue