FSM logs snapshot time

This commit is contained in:
Armon Dadgar 2013-12-17 11:13:19 -08:00
parent 7fbb2c9918
commit ab970083dd
1 changed files with 6 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import (
"github.com/hashicorp/raft"
"github.com/ugorji/go/codec"
"io"
"log"
"time"
)
// consulFSM implements a finite state machine that is used
@ -83,6 +85,10 @@ func (c *consulFSM) applyDeregister(buf []byte) interface{} {
}
func (c *consulFSM) Snapshot() (raft.FSMSnapshot, error) {
defer func(start time.Time) {
log.Printf("[INFO] FSM Snapshot created in %v", time.Now().Sub(start))
}(time.Now())
// Create a new snapshot
snap, err := c.state.Snapshot()
if err != nil {