nodeID uuid.UUID, address string) (*grpc.ClientConn, error) {
ctxTimeout, cancel := context.WithTimeout(ctx, 30*time.Second)
defer cancel()
conn, err := grpc.DialContext(ctxTimeout,
address,
grpc.WithBlock(),
grpc.WithInsecure())
...
}
I constantly get context canceled error despite 30 seconds no passing, but if I change to:
context.WithTimeout(context.Background(), 30*time.Second)
everything works fine
Can anyone point me to why that is? I guess it's related to the parent context, but I don't use withTimeout on it anywhere else
Show code for the failing scenario, because you have only shown what i suppose is working correctly?
Обсуждают сегодня