Skip to content

Commit

Permalink
move binding for AbandonCh
Browse files Browse the repository at this point in the history
  • Loading branch information
tgross committed Nov 16, 2022
1 parent e7703d1 commit b3f8ff5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nomad/encrypter.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func (krr *KeyringReplicator) run(ctx context.Context) {
defer krr.logger.Debug("exiting key replication")

store := krr.srv.fsm.State()
abandonCh := store.AbandonCh()
minIndex := uint64(0)

for {
Expand All @@ -447,12 +448,15 @@ func (krr *KeyringReplicator) run(ctx context.Context) {
return
case <-ctx.Done():
return
case <-store.AbandonCh():
case <-abandonCh:
// reset the blocking query to make sure we get all the keys from a
// restored snapshot
store = krr.srv.fsm.State()
abandonCh = store.AbandonCh()
minIndex = uint64(0)
default:
// ensure that we can abandon the blocking query periodically and
// give our other contexts a chance to fire
// ensure that we abandon the blocking query periodically to give
// other contexts a chance to fire
queryCtx, queryCancel := context.WithTimeout(ctx, time.Second)
defer queryCancel()

Expand Down

0 comments on commit b3f8ff5

Please sign in to comment.