Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Oct 21, 2022
1 parent d0abdaa commit d3f75c8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions extension/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,10 @@ type registry struct {
func (r *registry) Setup() error {
r.Lock()
defer r.Unlock()
if r.setup {
return nil
}

if _, err := r.doSetup(); err != nil {
return err
}

return nil
}

Expand All @@ -55,7 +51,7 @@ func (r *registry) Extensions() (*Extensions, error) {
}
r.RUnlock()

r.RLock()
r.Lock()
defer r.Unlock()
return r.doSetup()
}
Expand Down Expand Up @@ -89,6 +85,10 @@ func (r *registry) RegisterFactory(name string, factory func() ([]Option, error)

// Setup setups all extensions
func (r *registry) doSetup() (_ *Extensions, err error) {
if r.setup {
return r.extensions, nil
}

if len(r.factories) == 0 {
r.extensions = nil
r.setup = true
Expand Down

0 comments on commit d3f75c8

Please sign in to comment.