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