owner change on the corrent place
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m49s

This commit is contained in:
matst80
2024-11-09 21:11:05 +01:00
parent 411b91252b
commit 60ac1e5792

View File

@@ -180,6 +180,10 @@ var (
Name: "cart_connected_remotes", Name: "cart_connected_remotes",
Help: "The number of connected remotes", Help: "The number of connected remotes",
}) })
remoteLookupCount = promauto.NewCounter(prometheus.CounterOpts{
Name: "cart_remote_lookup_total",
Help: "The total number of remote lookups",
})
) )
const ( const (
@@ -455,13 +459,15 @@ func (p *SyncedPool) Process(id CartId, messages ...Message) ([]byte, error) {
// check if remote grain exists // check if remote grain exists
remoteGrain, ok := p.remoteIndex[id] remoteGrain, ok := p.remoteIndex[id]
if ok { if ok {
remoteLookupCount.Inc()
return remoteGrain.Process(id, messages...) return remoteGrain.Process(id, messages...)
} }
err := p.OwnerChanged(id, p.Hostname)
if err != nil {
return nil, err
}
} }
err := p.OwnerChanged(id, p.Hostname)
if err != nil {
return nil, err
}
return p.local.Process(id, messages...) return p.local.Process(id, messages...)
} }
@@ -472,8 +478,14 @@ func (p *SyncedPool) Get(id CartId) ([]byte, error) {
// check if remote grain exists // check if remote grain exists
remoteGrain, ok := p.remoteIndex[id] remoteGrain, ok := p.remoteIndex[id]
if ok { if ok {
remoteLookupCount.Inc()
return remoteGrain.Get(id) return remoteGrain.Get(id)
} }
err := p.OwnerChanged(id, p.Hostname)
if err != nil {
return nil, err
}
} }
return p.local.Get(id) return p.local.Get(id)
} }