Browse Source

Merge pull request #3146 from a-robinson/snap

snap: Record the snapshot save duration on success rather than only on error
Xiang Li 10 years ago
parent
commit
40681bdf03
1 changed files with 1 additions and 1 deletions
  1. 1 1
      snap/snapshotter.go

+ 1 - 1
snap/snapshotter.go

@@ -75,7 +75,7 @@ func (s *Snapshotter) save(snapshot *raftpb.Snapshot) error {
 		return err
 	}
 	err = ioutil.WriteFile(path.Join(s.dir, fname), d, 0666)
-	if err != nil {
+	if err == nil {
 		saveDurations.Observe(float64(time.Since(start).Nanoseconds() / int64(time.Microsecond)))
 	}
 	return err