From 2cfbacbcd76db5c2ceaa33b6d79703bb0f0e468d Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 10 Jan 2024 06:47:30 -0500 Subject: [PATCH] refactor: remove un-needed else --- service/registry.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/service/registry.go b/service/registry.go index f98a161..f91f87e 100644 --- a/service/registry.go +++ b/service/registry.go @@ -238,6 +238,11 @@ func (r *RegistryImpl) Get(pk []byte) (interfaces.SignedRegistryEntry, error) { if err != nil { return nil, err } + + if res != nil { + return res, nil + } + if res == nil { r.logger.Debug(fmt.Sprintf("[registry] get (cached) %s", key), zap.String("key", keyString)) for i := 0; i < 200; i++ { @@ -250,11 +255,9 @@ func (r *RegistryImpl) Get(pk []byte) (interfaces.SignedRegistryEntry, error) { break } } - } else { - r.logger.Debug(fmt.Sprintf("[registry] get (cached) %s", key), zap.String("key", keyString)) - time.Sleep(200 * time.Millisecond) } - return r.getFromDB(pk) + + return nil, nil } func (r *RegistryImpl) getFromDB(pk []byte) (sre interfaces.SignedRegistryEntry, err error) {