mirror of https://github.com/hashicorp/consul
Update agent/consul/state/catalog.go
Co-authored-by: Hans Hasselberg <me@hans.io>pull/7933/head
parent
3f607d9ef0
commit
04bf0f3490
|
@ -740,7 +740,7 @@ func (s *Store) EnsureService(idx uint64, node string, svc *structs.NodeService)
|
||||||
var errCASCompareFailed = errors.New("compare-and-set: comparison failed")
|
var errCASCompareFailed = errors.New("compare-and-set: comparison failed")
|
||||||
|
|
||||||
// ensureServiceCASTxn updates a service only if the existing index matches the given index.
|
// ensureServiceCASTxn updates a service only if the existing index matches the given index.
|
||||||
// Returns a bool indicating if a write happened and any error.
|
// Returns an error if the write didn't happen and nil if write was successful.
|
||||||
func (s *Store) ensureServiceCASTxn(tx *memdb.Txn, idx uint64, node string, svc *structs.NodeService) error {
|
func (s *Store) ensureServiceCASTxn(tx *memdb.Txn, idx uint64, node string, svc *structs.NodeService) error {
|
||||||
// Retrieve the existing service.
|
// Retrieve the existing service.
|
||||||
_, existing, err := firstWatchCompoundWithTxn(tx, "services", "id", &svc.EnterpriseMeta, node, svc.ID)
|
_, existing, err := firstWatchCompoundWithTxn(tx, "services", "id", &svc.EnterpriseMeta, node, svc.ID)
|
||||||
|
|
Loading…
Reference in New Issue