Skip to content

Commit 1b002dc

Browse files
committed
Make cannotConnectNow a non-fatal error
1 parent 4b7723e commit 1b002dc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎Sources/PostgresConnectionPool/PostgresConnectionPool.swift‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,14 +562,17 @@ public actor PostgresConnectionPool {
562562
// TODO: Check which of these errors is actually fatal
563563
switch PostgresError.Code(raw: code) {
564564
case .adminShutdown,
565-
.cannotConnectNow,
566565
.invalidAuthorizationSpecification,
567566
.invalidName,
568567
.invalidPassword:
569568
logger.error(logMessage)
570569
await shutdown(withError: psqlError)
571570
return
572571

572+
case .cannotConnectNow:
573+
let delay = UInt64(connectionRetryInterval * 1_000_000_000)
574+
try? await Task<Never, Never>.sleep(nanoseconds: delay)
575+
573576
default:
574577
break
575578
}

0 commit comments

Comments
 (0)