Skip to content

Commit 865fc53

Browse files
author
Max Maximov
committed
tarantool#389: add some logging for error of ConnectionPool.tryConnect
1 parent be0f71e commit 865fc53

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Diff for: pool/connection_pool.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ func (p *ConnectionPool) Add(ctx context.Context, instance Instance) error {
289289
e.cancel()
290290
close(e.closed)
291291
return err
292+
} else {
293+
log.Printf("tarantool: connect to %s failed: %s\n", instance.Name, err)
292294
}
293295
}
294296

@@ -1329,14 +1331,20 @@ func (p *ConnectionPool) reconnect(ctx context.Context, e *endpoint) {
13291331
e.conn = nil
13301332
e.role = UnknownRole
13311333

1332-
p.tryConnect(ctx, e)
1334+
if err := p.tryConnect(ctx, e); err != nil {
1335+
log.Printf("tarantool: reconnect to %s failed: %s\n", e.name, err)
1336+
}
13331337
}
13341338

13351339
func (p *ConnectionPool) controller(ctx context.Context, e *endpoint) {
13361340
timer := time.NewTicker(p.opts.CheckTimeout)
13371341
defer timer.Stop()
13381342

1339-
shutdown := false
1343+
var (
1344+
shutdown = false
1345+
err error
1346+
)
1347+
13401348
for {
13411349
if shutdown {
13421350
// Graceful shutdown in progress. We need to wait for a finish or
@@ -1417,7 +1425,9 @@ func (p *ConnectionPool) controller(ctx context.Context, e *endpoint) {
14171425
// Relocate connection between subpools
14181426
// if ro/rw was updated.
14191427
if e.conn == nil {
1420-
p.tryConnect(ctx, e)
1428+
if err = p.tryConnect(ctx, e); err != nil {
1429+
log.Printf("tarantool: reopen connection to %s failed: %s\n", e.name, err)
1430+
}
14211431
} else if !e.conn.ClosedNow() {
14221432
p.updateConnection(e)
14231433
} else {

0 commit comments

Comments
 (0)