mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 03:15:42 +03:00
Merge pull request #5773 from hashicorp/b-revert-planapply-snapshotafter
nomad: revert use of SnapshotAfter in planApply
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package nomad
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"time"
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user