Skip to content

Commit

Permalink
check for error before closing conn
Browse files Browse the repository at this point in the history
  • Loading branch information
mathnogueira committed May 2, 2024
1 parent 8ca531a commit 4161e9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion agent/workers/poller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ func (w *PollerWorker) poll(ctx context.Context, request *proto.PollingRequest)

dsFactory := tracedb.Factory(nil)
ds, err := dsFactory(*datastoreConfig)
defer ds.Close()
if err != nil {
w.logger.Error("Invalid datastore", zap.Error(err))
log.Printf("Invalid datastore: %s", err.Error())
return err
}
defer ds.Close()
w.logger.Debug("Created datastore", zap.Any("datastore", ds), zap.Bool("isOTLPBasedProvider", datastoreConfig.IsOTLPBasedProvider()))

if datastoreConfig.IsOTLPBasedProvider() && w.inmemoryDatastore != nil {
Expand Down

0 comments on commit 4161e9e

Please sign in to comment.