Skip to content

Commit

Permalink
context propagation: don't store ctx in api controller (#3268)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmetc authored Oct 3, 2024
1 parent 56c9c7a commit af3116d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 8 deletions.
1 change: 0 additions & 1 deletion pkg/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ func NewServer(config *csconfig.LocalApiServerCfg) (*APIServer, error) {

controller := &controllers.Controller{
DBClient: dbClient,
Ectx: ctx,
Router: router,
Profiles: config.Profiles,
Log: clog,
Expand Down
3 changes: 0 additions & 3 deletions pkg/apiserver/controllers/controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package controllers

import (
"context"
"net"
"net/http"
"strings"
Expand All @@ -18,7 +17,6 @@ import (
)

type Controller struct {
Ectx context.Context
DBClient *database.Client
Router *gin.Engine
Profiles []*csconfig.ProfileCfg
Expand Down Expand Up @@ -83,7 +81,6 @@ func (c *Controller) NewV1() error {

v1Config := v1.ControllerV1Config{
DbClient: c.DBClient,
Ctx: c.Ectx,
ProfilesCfg: c.Profiles,
DecisionDeleteChan: c.DecisionDeleteChan,
AlertsAddChan: c.AlertsAddChan,
Expand Down
4 changes: 0 additions & 4 deletions pkg/apiserver/controllers/v1/controller.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package v1

import (
"context"
"fmt"
"net"

Expand All @@ -14,7 +13,6 @@ import (
)

type Controller struct {
Ectx context.Context
DBClient *database.Client
APIKeyHeader string
Middlewares *middlewares.Middlewares
Expand All @@ -31,7 +29,6 @@ type Controller struct {

type ControllerV1Config struct {
DbClient *database.Client
Ctx context.Context
ProfilesCfg []*csconfig.ProfileCfg

AlertsAddChan chan []*models.Alert
Expand All @@ -52,7 +49,6 @@ func New(cfg *ControllerV1Config) (*Controller, error) {
}

v1 := &Controller{
Ectx: cfg.Ctx,
DBClient: cfg.DbClient,
APIKeyHeader: middlewares.APIKeyHeader,
Profiles: profiles,
Expand Down

0 comments on commit af3116d

Please sign in to comment.