Skip to content

Commit

Permalink
Simplify proservices.go
Browse files Browse the repository at this point in the history
Say goodbye to a weird deferred function and an unnecessary goroutine
  • Loading branch information
EduardGomezEscandell committed Oct 26, 2023
1 parent e5d9dad commit 591b8ac
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions windows-agent/internal/proservices/proservices.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,11 @@ func New(ctx context.Context, args ...Option) (s Manager, err error) {
if err != nil {
return s, err
}
defer func() {
if err != nil {
db.Close(ctx)
}
}()
defer db.Close(ctx)

go func() {
err := conf.UpdateRegistrySettings(ctx, opts.cacheDir, db)
if err != nil {
log.Warningf(ctx, "Could not update subscriptions: %v", err)
}
}()
if err := conf.UpdateRegistrySettings(ctx, opts.cacheDir, db); err != nil {
log.Warningf(ctx, "Could not update registry settings: %v", err)
}

uiService := ui.New(ctx, conf, db)

Expand Down

0 comments on commit 591b8ac

Please sign in to comment.