Skip to content

Commit

Permalink
Merge pull request #5773 from hashicorp/b-revert-planapply-snapshotafter
Browse files Browse the repository at this point in the history
nomad: revert use of SnapshotAfter in planApply
  • Loading branch information
schmichael authored Jun 4, 2019
2 parents 168e3e9 + cd3cd0a commit 0a29d67
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions nomad/plan_apply.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package nomad

import (
"context"
"fmt"
"runtime"
"time"
Expand Down Expand Up @@ -100,15 +99,7 @@ func (p *planner) planApply() {
// Snapshot the state so that we have a consistent view of the world
// if no snapshot is available
if waitCh == nil || snap == nil {
// Wait up to 5s for raft to catch up. Timing out
// causes the eval to be nacked and retried on another
// server, so timing out too quickly could cause
// greater scheduling latency than if we just waited
// longer here.
const indexTimeout = 5 * time.Second
ctx, cancel := context.WithTimeout(context.Background(), indexTimeout)
snap, err = p.fsm.State().SnapshotAfter(ctx, p.raft.LastIndex())
cancel()
snap, err = p.fsm.State().Snapshot()
if err != nil {
p.logger.Error("failed to snapshot state", "error", err)
pending.respond(nil, err)
Expand Down

0 comments on commit 0a29d67

Please sign in to comment.