Skip to content

Commit

Permalink
chore: pass context to ProContext factory
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 committed Oct 18, 2024
1 parent 8d95976 commit e5534a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmd/api-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func main() {
grpcClient = cloud.NewTestKubeCloudAPIClient(grpcConn)
}

proContext := newProContext(cfg, grpcClient)
proContext := newProContext(ctx, cfg, grpcClient)

// Check Pro/Enterprise subscription
subscriptionChecker, err := checktcl.NewSubscriptionChecker(ctx, proContext, grpcClient, grpcConn)
Expand Down Expand Up @@ -710,7 +710,7 @@ func newSlackLoader(cfg *config.Config, envs map[string]string) (*slack.SlackLoa
testkube.AllEventTypes, envs), nil
}

func newProContext(cfg *config.Config, grpcClient cloud.TestKubeCloudAPIClient) config.ProContext {
func newProContext(ctx context.Context, cfg *config.Config, grpcClient cloud.TestKubeCloudAPIClient) config.ProContext {
proContext := config.ProContext{
APIKey: cfg.TestkubeProAPIKey,
URL: cfg.TestkubeProURL,
Expand All @@ -730,7 +730,7 @@ func newProContext(cfg *config.Config, grpcClient cloud.TestKubeCloudAPIClient)
return proContext
}

ctx, cancel := context.WithTimeout(context.Background(), time.Second*3)
ctx, cancel := context.WithTimeout(ctx, time.Second*3)
md := metadata.Pairs("api-key", cfg.TestkubeProAPIKey)
ctx = metadata.NewOutgoingContext(ctx, md)
defer cancel()
Expand Down

0 comments on commit e5534a1

Please sign in to comment.