mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 01:45:44 +03:00
{volume|deployment}watcher: check for nil batcher
This commit is contained in:
@@ -366,7 +366,11 @@ func (w *Watcher) FailDeployment(req *structs.DeploymentFailRequest, resp *struc
|
||||
// createUpdate commits the given allocation desired transition and evaluation
|
||||
// to Raft but batches the commit with other calls.
|
||||
func (w *Watcher) createUpdate(allocs map[string]*structs.DesiredTransition, eval *structs.Evaluation) (uint64, error) {
|
||||
return w.allocUpdateBatcher.CreateUpdate(allocs, eval).Results()
|
||||
b := w.allocUpdateBatcher
|
||||
if b == nil {
|
||||
return 0, notEnabled
|
||||
}
|
||||
return b.CreateUpdate(allocs, eval).Results()
|
||||
}
|
||||
|
||||
// upsertJob commits the given job to Raft
|
||||
|
||||
@@ -2,6 +2,7 @@ package volumewatcher
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -233,5 +234,9 @@ func (w *Watcher) removeLocked(volID, namespace string) {
|
||||
// updatesClaims sends the claims to the batch updater and waits for
|
||||
// the results
|
||||
func (w *Watcher) updateClaims(claims []structs.CSIVolumeClaimRequest) (uint64, error) {
|
||||
return w.volumeUpdateBatcher.CreateUpdate(claims).Results()
|
||||
b := w.volumeUpdateBatcher
|
||||
if b == nil {
|
||||
return 0, errors.New("volume watcher is not enabled")
|
||||
}
|
||||
return b.CreateUpdate(claims).Results()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user