refactor everything again
All checks were successful
Build and Publish / BuildAndDeploy (push) Successful in 1m51s

This commit is contained in:
matst80
2024-11-10 20:10:47 +01:00
parent 7a4d9b1540
commit 8f0e062817
7 changed files with 125 additions and 145 deletions

View File

@@ -24,19 +24,19 @@ func ToCartId(id string) CartId {
type RemoteGrain struct {
*CartClient
Id CartId
Address string
Id CartId
Host string
}
func NewRemoteGrain(id CartId, address string) (*RemoteGrain, error) {
client, err := CartDial(fmt.Sprintf("%s:1337", address))
func NewRemoteGrain(id CartId, host string) (*RemoteGrain, error) {
client, err := CartDial(fmt.Sprintf("%s:1337", host))
if err != nil {
return nil, err
}
return &RemoteGrain{
Id: id,
Address: address,
Host: host,
CartClient: client,
}, nil
}
@@ -75,7 +75,7 @@ func (p *RemoteGrainPool) findRemoteGrain(id CartId) *RemoteGrain {
p.mu.RLock()
grain, ok := p.grains[id]
p.mu.RUnlock()
if !ok || grain == nil {
if !ok {
return nil
}
return grain