From d3649d3254e37907f4e564938dcc8cccf5ab662c Mon Sep 17 00:00:00 2001 From: Xiang Li Date: Sun, 11 Aug 2013 09:48:12 -0700 Subject: [PATCH] gofmt --- etcd.go | 4 ++-- etcd_handlers.go | 2 +- snapshot.go | 14 +++++++------- store/stats.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/etcd.go b/etcd.go index 50acc282a..042663629 100644 --- a/etcd.go +++ b/etcd.go @@ -364,7 +364,7 @@ func newTransporter(scheme string, tlsConf tls.Config) transporter { t.scheme = scheme tr := &http.Transport{ - Dial: dialTimeout, + Dial: dialTimeout, } if scheme == "https" { @@ -594,7 +594,7 @@ func joinCluster(s *raft.Server, raftURL string) error { joinURL := url.URL{Host: raftURL, Scheme: raftTransporter.scheme, Path: "/join"} debugf("Send Join Request to %s", raftURL) - + resp, err := t.Post(joinURL.String(), &b) for { diff --git a/etcd_handlers.go b/etcd_handlers.go index 3936bf493..b391f2ada 100644 --- a/etcd_handlers.go +++ b/etcd_handlers.go @@ -109,7 +109,7 @@ func DeleteHttpHandler(w *http.ResponseWriter, req *http.Request) { func dispatch(c Command, w *http.ResponseWriter, req *http.Request, etcd bool) { if raftServer.State() == "leader" { if body, err := raftServer.Do(c); err != nil { - + if _, ok := err.(store.NotFoundError); ok { (*w).WriteHeader(http.StatusNotFound) (*w).Write(newJsonError(100, err.Error())) diff --git a/snapshot.go b/snapshot.go index 16a3d8d19..6697b0203 100644 --- a/snapshot.go +++ b/snapshot.go @@ -1,25 +1,25 @@ package main import ( - "time" "fmt" + "time" ) type snapshotConf struct { - // basic + // basic checkingInterval time.Duration - lastWrites uint64 - writesThr uint64 + lastWrites uint64 + writesThr uint64 } var snapConf *snapshotConf func newSnapshotConf() *snapshotConf { - return &snapshotConf {time.Second*3, etcdStore.TotalWrites(), 20*1000} + return &snapshotConf{time.Second * 3, etcdStore.TotalWrites(), 20 * 1000} } func monitorSnapshot() { - for { + for { time.Sleep(snapConf.checkingInterval) currentWrites := etcdStore.TotalWrites() - snapConf.lastWrites @@ -31,4 +31,4 @@ func monitorSnapshot() { fmt.Println(currentWrites) } } -} \ No newline at end of file +} diff --git a/store/stats.go b/store/stats.go index 3270ae84a..b57f4db3d 100644 --- a/store/stats.go +++ b/store/stats.go @@ -30,4 +30,4 @@ func (s *Store) TotalWrites() uint64 { bs := s.BasicStats return bs.Deletes + bs.Sets + bs.TestAndSets -} \ No newline at end of file +}