mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-10-10 23:36:28 +00:00
fix(dbmanager): explicitly ignore best-effort listener close errors
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
da1af1487e
commit
3657aa94cc
@@ -108,7 +108,7 @@ func (l *PostgresListener) dial(ctx context.Context) (*pgx.Conn, error) {
|
|||||||
// Test the connection
|
// Test the connection
|
||||||
if err = conn.Ping(ctx); err != nil {
|
if err = conn.Ping(ctx); err != nil {
|
||||||
lastErr = err
|
lastErr = err
|
||||||
closeConnBounded(conn)
|
_ = closeConnBounded(conn)
|
||||||
if l.config.GetEnableLogging() {
|
if l.config.GetEnableLogging() {
|
||||||
logger.Warn("Failed to ping PostgreSQL listener: %v", err)
|
logger.Warn("Failed to ping PostgreSQL listener: %v", err)
|
||||||
}
|
}
|
||||||
@@ -412,13 +412,13 @@ func (l *PostgresListener) reconnect(ctx context.Context) error {
|
|||||||
|
|
||||||
for _, ch := range channels {
|
for _, ch := range channels {
|
||||||
if _, err := conn.Exec(ctx, fmt.Sprintf("LISTEN %s", pgx.Identifier{ch}.Sanitize())); err != nil {
|
if _, err := conn.Exec(ctx, fmt.Sprintf("LISTEN %s", pgx.Identifier{ch}.Sanitize())); err != nil {
|
||||||
closeConnBounded(conn)
|
_ = closeConnBounded(conn)
|
||||||
return fmt.Errorf("failed to resubscribe to channel %s: %w", ch, err)
|
return fmt.Errorf("failed to resubscribe to channel %s: %w", ch, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if l.ctx.Err() != nil {
|
if l.ctx.Err() != nil {
|
||||||
closeConnBounded(conn)
|
_ = closeConnBounded(conn)
|
||||||
return l.ctx.Err()
|
return l.ctx.Err()
|
||||||
}
|
}
|
||||||
l.swapConn(conn)
|
l.swapConn(conn)
|
||||||
@@ -434,7 +434,7 @@ func (l *PostgresListener) swapConn(conn *pgx.Conn) {
|
|||||||
l.conn = conn
|
l.conn = conn
|
||||||
l.mu.Unlock()
|
l.mu.Unlock()
|
||||||
if old != nil {
|
if old != nil {
|
||||||
closeConnBounded(old)
|
_ = closeConnBounded(old)
|
||||||
}
|
}
|
||||||
l.connMu.Unlock()
|
l.connMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user