Skip to content

Commit

Permalink
Inject tenantID
Browse files Browse the repository at this point in the history
  • Loading branch information
periklis committed Feb 4, 2025
1 parent 68e7fca commit 7e16743
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tools/stream-metadata-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ func (s *generator) running(ctx context.Context) error {
return
}

userCtx, err := user.InjectIntoGRPCRequest(user.InjectOrgID(ctx, tenantID))
if err != nil {
errCh <- err
return
}

// Create a ticker for rate limiting based on QPSPerTenant
ticker := time.NewTicker(time.Second / time.Duration(s.cfg.QPSPerTenant))
defer ticker.Stop()
Expand Down Expand Up @@ -317,13 +323,8 @@ func (s *generator) running(ctx context.Context) error {

// Check if the stream exceeds limits
if client != nil {
ctx, err := user.InjectIntoGRPCRequest(user.InjectOrgID(ctx, tenantID))
if err != nil {
errCh <- err
return
}

resp, err := client.ExceedsLimits(ctx, req)
resp, err := client.ExceedsLimits(userCtx, req)
if err != nil {
errCh <- errors.Wrapf(err, "failed to check limits for tenant %s", tenantID)
return
Expand Down

0 comments on commit 7e16743

Please sign in to comment.