Skip to content

Commit 2cdd00a

Browse files
authored
close conn if auth fails (#144)
1 parent 74d49fd commit 2cdd00a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/PostgresKit/PostgresConnectionSource.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ public struct PostgresConnectionSource: ConnectionPoolSource {
2323
username: self.configuration.username,
2424
database: self.configuration.database,
2525
password: self.configuration.password
26-
).map { conn }
26+
).flatMapError { error in
27+
return conn.close()
28+
.flatMapThrowing { throw error }
29+
}.map { conn }
2730
}
2831
}
2932
}

0 commit comments

Comments
 (0)