Set params on store before opening
@@ -175,9 +175,8 @@ func main() {
Dir: dataPath,
Tn: raftTn,
})
- if err := store.Open(joinAddr == ""); err != nil {
- log.Fatalf("failed to open store: %s", err.Error())
- }
+
+ // Set optional parameters on store.
store.SnapshotThreshold = raftSnapThreshold
store.HeartbeatTimeout, err = time.ParseDuration(raftHeartbeatTimeout)
if err != nil {
@@ -192,6 +191,11 @@ func main() {
log.Fatalf("failed to parse Raft open timeout %s: %s", raftOpenTimeout, err.Error())
}
+ // Now, open it.
+ if err := store.Open(joinAddr == ""); err != nil {
+ log.Fatalf("failed to open store: %s", err.Error())
+ }
+
// Create and configure cluster service.
tn := mux.Listen(muxMetaHeader)
cs := cluster.NewService(tn, store)
