refactor context

pull/20343/head
Xinyi Wang 2024-01-25 14:56:44 -08:00
parent 1b3600dcb9
commit 9abb1c2430
1 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ func (client *GRPCClient) Apply(parsedResource *pbresource.Resource) (*pbresourc
} }
ctx := context.Background() ctx := context.Background()
if token != "" { if token != "" {
ctx = metadata.AppendToOutgoingContext(context.Background(), HeaderConsulToken, token) ctx = metadata.AppendToOutgoingContext(ctx, HeaderConsulToken, token)
} }
defer client.Conn.Close() defer client.Conn.Close()
@ -66,7 +66,7 @@ func (client *GRPCClient) Read(resourceType *pbresource.Type, resourceTenancy *p
ctx = metadata.AppendToOutgoingContext(ctx, "x-consul-consistency-mode", "consistent") ctx = metadata.AppendToOutgoingContext(ctx, "x-consul-consistency-mode", "consistent")
} }
if token != "" { if token != "" {
ctx = metadata.AppendToOutgoingContext(context.Background(), HeaderConsulToken, token) ctx = metadata.AppendToOutgoingContext(ctx, HeaderConsulToken, token)
} }
defer client.Conn.Close() defer client.Conn.Close()