fix: Get needs to actually return the entry

This commit is contained in:
Derrick Hammer 2024-03-03 11:26:44 -05:00
parent 15d0999fdf
commit c6aa2cf4a2
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 10 additions and 12 deletions

View File

@ -240,21 +240,19 @@ func (r *RegistryServiceDefault) Get(pk []byte) (protocol.SignedRegistryEntry, e
return res, nil return res, nil
} }
if res == nil { r.Logger().Debug("[registry] get (cached)", zap.String("key", keyString))
r.Logger().Debug("[registry] get (cached)", zap.String("key", keyString)) for i := 0; i < 200; i++ {
for i := 0; i < 200; i++ { time.Sleep(10 * time.Millisecond)
time.Sleep(10 * time.Millisecond) res, err = r.getFromDB(pk)
res, err := r.getFromDB(pk) if err != nil {
if err != nil { return nil, err
return nil, err }
} if res != nil {
if res != nil { break
break
}
} }
} }
return nil, nil return res, nil
} }
func (r *RegistryServiceDefault) Listen(pk []byte, cb func(sre protocol.SignedRegistryEntry)) (func(), error) { func (r *RegistryServiceDefault) Listen(pk []byte, cb func(sre protocol.SignedRegistryEntry)) (func(), error) {