Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 061f322

Browse files
committed
transport: conn, abort OpenShardConn faster when context is done
1 parent 88fc8ef commit 061f322

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

transport/conn.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,10 @@ func OpenShardConn(ctx context.Context, addr string, si ShardInfo, cfg ConnConfi
378378
for i := 0; i < maxTries; i++ {
379379
conn, err := OpenLocalPortConn(ctx, addr, it(), cfg)
380380
if err != nil {
381+
if err := ctx.Err(); err != nil {
382+
return nil, fmt.Errorf("aborted opening connection on shard %d: %w", si.Shard, err)
383+
}
384+
381385
log.Printf("%s dial error: %s (try %d/%d)", addr, err, i, maxTries)
382386
if conn != nil {
383387
conn.Close()

0 commit comments

Comments
 (0)