remove locks
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 32s
Build and Publish / BuildAndDeploy (push) Successful in 2m28s

This commit is contained in:
matst80
2024-11-13 09:59:29 +01:00
parent bc6666f31a
commit 173c4d3151
3 changed files with 8 additions and 6 deletions

Binary file not shown.

View File

@@ -115,8 +115,8 @@ func (p *GrainLocalPool) GetGrains() map[CartId]*CartGrain {
func (p *GrainLocalPool) GetGrain(id CartId) (*CartGrain, error) {
var err error
p.mu.RLock()
defer p.mu.RUnlock()
// p.mu.RLock()
// defer p.mu.RUnlock()
grain, ok := p.grains[id]
grainLookups.Inc()
if grain == nil || !ok {

View File

@@ -320,8 +320,8 @@ func (p *SyncedPool) Negotiate() {
}
func (p *SyncedPool) GetHealthyRemotes() []*RemoteHost {
p.mu.RLock()
defer p.mu.RUnlock()
// p.mu.RLock()
// defer p.mu.RUnlock()
remotes := make([]*RemoteHost, 0, len(p.remotes))
for _, r := range p.remotes {
if r.IsHealthy() {
@@ -422,12 +422,14 @@ func (p *SyncedPool) AddRemote(host string) error {
func (p *SyncedPool) getGrain(id CartId) (Grain, error) {
var err error
p.mu.RLock()
defer p.mu.RUnlock()
localGrain, ok := p.local.grains[id]
if !ok {
// check if remote grain exists
p.mu.RLock()
remoteGrain, ok := p.remoteIndex[id]
p.mu.RUnlock()
if ok {
remoteLookupCount.Inc()
return remoteGrain, nil