Skip to content

fix: replace context.TODO() with context.Background() in background/startup paths #95

Description

@KorsarOfficial

Problem

11 call sites across cmd/, internal/, and pkg/ use context.TODO() in places where the intent is clearly a long-lived background context:

bgCtx := context.TODO()  // in server startup, background goroutines, cache callbacks

context.TODO() signals "I haven't decided what context to use yet" — a placeholder for work-in-progress. These sites are all settled background operations where context.Background() is the semantically correct and final choice.

Proposed fix

Replace context.TODO()context.Background() in:

  • Server startup sequences (cmd/gc, agent_gateway, symbolizer)
  • Background processing loops (binaryprocessor, offline_processing)
  • Cache eviction callbacks (dso/map.go)
  • Long-running service goroutines (kafka/producer, s3/http_proxy)

No behaviour change at runtime — purely a correctness/readability fix.

Files affected

11 files in perforator/cmd/, perforator/internal/, perforator/pkg/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions