@@ -168,32 +168,32 @@ func main() {
168
168
svc := new (checkoutService )
169
169
170
170
mustMapEnv (& svc .shippingSvcAddr , "SHIPPING_SERVICE_ADDR" )
171
- c := mustCreateClient (context . Background (), svc .shippingSvcAddr )
171
+ c := mustCreateClient (svc .shippingSvcAddr )
172
172
svc .shippingSvcClient = pb .NewShippingServiceClient (c )
173
173
defer c .Close ()
174
174
175
175
mustMapEnv (& svc .productCatalogSvcAddr , "PRODUCT_CATALOG_SERVICE_ADDR" )
176
- c = mustCreateClient (context . Background (), svc .productCatalogSvcAddr )
176
+ c = mustCreateClient (svc .productCatalogSvcAddr )
177
177
svc .productCatalogSvcClient = pb .NewProductCatalogServiceClient (c )
178
178
defer c .Close ()
179
179
180
180
mustMapEnv (& svc .cartSvcAddr , "CART_SERVICE_ADDR" )
181
- c = mustCreateClient (context . Background (), svc .cartSvcAddr )
181
+ c = mustCreateClient (svc .cartSvcAddr )
182
182
svc .cartSvcClient = pb .NewCartServiceClient (c )
183
183
defer c .Close ()
184
184
185
185
mustMapEnv (& svc .currencySvcAddr , "CURRENCY_SERVICE_ADDR" )
186
- c = mustCreateClient (context . Background (), svc .currencySvcAddr )
186
+ c = mustCreateClient (svc .currencySvcAddr )
187
187
svc .currencySvcClient = pb .NewCurrencyServiceClient (c )
188
188
defer c .Close ()
189
189
190
190
mustMapEnv (& svc .emailSvcAddr , "EMAIL_SERVICE_ADDR" )
191
- c = mustCreateClient (context . Background (), svc .emailSvcAddr )
191
+ c = mustCreateClient (svc .emailSvcAddr )
192
192
svc .emailSvcClient = pb .NewEmailServiceClient (c )
193
193
defer c .Close ()
194
194
195
195
mustMapEnv (& svc .paymentSvcAddr , "PAYMENT_SERVICE_ADDR" )
196
- c = mustCreateClient (context . Background (), svc .paymentSvcAddr )
196
+ c = mustCreateClient (svc .paymentSvcAddr )
197
197
svc .paymentSvcClient = pb .NewPaymentServiceClient (c )
198
198
defer c .Close ()
199
199
@@ -373,8 +373,8 @@ func (cs *checkoutService) prepareOrderItemsAndShippingQuoteFromCart(ctx context
373
373
return out , nil
374
374
}
375
375
376
- func mustCreateClient (ctx context. Context , svcAddr string ) * grpc.ClientConn {
377
- c , err := grpc .DialContext ( ctx , svcAddr ,
376
+ func mustCreateClient (svcAddr string ) * grpc.ClientConn {
377
+ c , err := grpc .NewClient ( svcAddr ,
378
378
grpc .WithTransportCredentials (insecure .NewCredentials ()),
379
379
grpc .WithStatsHandler (otelgrpc .NewClientHandler ()),
380
380
)
@@ -444,7 +444,7 @@ func (cs *checkoutService) chargeCard(ctx context.Context, amount *pb.Money, pay
444
444
paymentService := cs .paymentSvcClient
445
445
if cs .isFeatureFlagEnabled (ctx , "paymentServiceUnreachable" ) {
446
446
badAddress := "badAddress:50051"
447
- c := mustCreateClient (context . Background (), badAddress )
447
+ c := mustCreateClient (badAddress )
448
448
paymentService = pb .NewPaymentServiceClient (c )
449
449
}
450
450
0 commit comments