Skip to content

Commit

Permalink
add missing ctx/cancel
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed Jan 26, 2025
1 parent 7b1aec4 commit 13cc281
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions components/memory/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func New(ctx context.Context, cfg Config) (components.Component, error) {
}

return &component{
rootCtx: ctx,
ctx: cctx,
cancel: ccancel,
poller: getDefaultPoller(),
cfg: cfg,
Expand All @@ -53,7 +53,7 @@ func New(ctx context.Context, cfg Config) (components.Component, error) {
var _ components.Component = (*component)(nil)

type component struct {
rootCtx context.Context
ctx context.Context
cancel context.CancelFunc
poller query.Poller
cfg Config
Expand Down Expand Up @@ -142,6 +142,7 @@ func (c *component) Metrics(ctx context.Context, since time.Time) ([]components.

func (c *component) Close() error {
log.Logger.Debugw("closing component")
c.cancel()

Check warning on line 145 in components/memory/component.go

View check run for this annotation

Codecov / codecov/patch

components/memory/component.go#L145

Added line #L145 was not covered by tests

// safe to call stop multiple times
c.poller.Stop(memory_id.Name)
Expand Down

0 comments on commit 13cc281

Please sign in to comment.