diff --git a/Sources/PostgresNIO/New/Extensions/Logging+PSQL.swift b/Sources/PostgresNIO/New/Extensions/Logging+PSQL.swift index 97c729f0..c76ace84 100644 --- a/Sources/PostgresNIO/New/Extensions/Logging+PSQL.swift +++ b/Sources/PostgresNIO/New/Extensions/Logging+PSQL.swift @@ -19,8 +19,8 @@ extension PSQLConnection { case message = "psql_message" case messageID = "psql_message_id" case messagePayload = "psql_message_payload" - - + case rowCount = "psql_row_count" + case database = "psql_database" case username = "psql_username" diff --git a/Sources/PostgresNIO/New/PSQLRowStream.swift b/Sources/PostgresNIO/New/PSQLRowStream.swift index b3dfea30..96fd4bd9 100644 --- a/Sources/PostgresNIO/New/PSQLRowStream.swift +++ b/Sources/PostgresNIO/New/PSQLRowStream.swift @@ -280,7 +280,7 @@ final class PSQLRowStream: @unchecked Sendable { precondition(!newRows.isEmpty, "Expected to get rows!") self.eventLoop.preconditionInEventLoop() self.logger.trace("Row stream received rows", metadata: [ - "row_count": "\(newRows.count)" + .rowCount: "\(newRows.count)" ]) switch self.downstreamState { diff --git a/Sources/PostgresNIO/New/PostgresChannelHandler.swift b/Sources/PostgresNIO/New/PostgresChannelHandler.swift index 54ae0fc9..f987b699 100644 --- a/Sources/PostgresNIO/New/PostgresChannelHandler.swift +++ b/Sources/PostgresNIO/New/PostgresChannelHandler.swift @@ -101,7 +101,7 @@ final class PostgresChannelHandler: ChannelDuplexHandler { } func errorCaught(context: ChannelHandlerContext, error: Error) { - self.logger.debug("Channel error caught.", metadata: [.error: "\(error)"]) + self.logger.debug("Channel error caught.", metadata: [.error: "\(String(reflecting: error))"]) let action = self.state.errorHappened(.connectionError(underlying: error)) self.run(action, with: context) } @@ -563,8 +563,8 @@ final class PostgresChannelHandler: ChannelDuplexHandler { _ cleanup: ConnectionStateMachine.ConnectionAction.CleanUpContext, context: ChannelHandlerContext ) { - self.logger.debug("Cleaning up and closing connection.", metadata: [.error: "\(cleanup.error)"]) - + self.logger.debug("Cleaning up and closing connection.", metadata: [.error: "\(String(reflecting: cleanup.error))"]) + // 1. fail all tasks cleanup.tasks.forEach { task in task.failWithError(cleanup.error) diff --git a/Sources/PostgresNIO/Utilities/PostgresJSONDecoder.swift b/Sources/PostgresNIO/Utilities/PostgresJSONDecoder.swift index ba57ee9b..935efc25 100644 --- a/Sources/PostgresNIO/Utilities/PostgresJSONDecoder.swift +++ b/Sources/PostgresNIO/Utilities/PostgresJSONDecoder.swift @@ -22,7 +22,6 @@ extension PostgresJSONDecoder { } } -//@available(macOS 13.0, iOS 16.0, tvOS 16.0, watchOS 9.0, *) extension JSONDecoder: PostgresJSONDecoder {} private let jsonDecoderLocked: NIOLockedValueBox = NIOLockedValueBox(JSONDecoder()) diff --git a/Tests/ConnectionPoolModuleTests/ConnectionPoolTests.swift b/Tests/ConnectionPoolModuleTests/ConnectionPoolTests.swift index ba3c6a3f..3e3c9d65 100644 --- a/Tests/ConnectionPoolModuleTests/ConnectionPoolTests.swift +++ b/Tests/ConnectionPoolModuleTests/ConnectionPoolTests.swift @@ -803,7 +803,7 @@ final class ConnectionPoolTests: XCTestCase { pool.connectionReceivedNewMaxStreamSetting(connection, newMaxStreamSetting: 21) - for (index, request) in requests.enumerated() { + for (_, request) in requests.enumerated() { let connection = try await request.future.success connections.append(connection) }