From e1b15865ff7b442152517dc60eac61c5f0e02d1d Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Fri, 14 Jun 2024 10:49:25 +0200 Subject: [PATCH] More cleanup --- Sources/ConnectionPoolModule/ConnectionPool.swift | 8 ++++---- Sources/PostgresNIO/New/NotificationListener.swift | 2 +- Sources/PostgresNIO/Utilities/Exports.swift | 11 ----------- 3 files changed, 5 insertions(+), 16 deletions(-) diff --git a/Sources/ConnectionPoolModule/ConnectionPool.swift b/Sources/ConnectionPoolModule/ConnectionPool.swift index 8ba0e7be..3231cc06 100644 --- a/Sources/ConnectionPoolModule/ConnectionPool.swift +++ b/Sources/ConnectionPoolModule/ConnectionPool.swift @@ -273,7 +273,7 @@ public final class ConnectionPool< public func run() async { await withTaskCancellationHandler { - #if swift(>=5.8) && os(Linux) || swift(>=5.9) + #if os(Linux) || compiler(>=5.9) if #available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *) { return await withDiscardingTaskGroup() { taskGroup in await self.run(in: &taskGroup) @@ -313,7 +313,7 @@ public final class ConnectionPool< case scheduleTimer(StateMachine.Timer) } - #if swift(>=5.8) && os(Linux) || swift(>=5.9) + #if os(Linux) || compiler(>=5.9) @available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *) private func run(in taskGroup: inout DiscardingTaskGroup) async { for await event in self.eventStream { @@ -507,7 +507,7 @@ public final class ConnectionPool< await withTaskGroup(of: TimerRunResult.self, returning: Void.self) { taskGroup in taskGroup.addTask { do { - #if swift(>=5.8) && os(Linux) || swift(>=5.9) + #if os(Linux) || compiler(>=5.9) try await self.clock.sleep(for: timer.duration) #else try await self.clock.sleep(until: self.clock.now.advanced(by: timer.duration), tolerance: nil) @@ -593,7 +593,7 @@ protocol TaskGroupProtocol { mutating func addTask_(operation: @escaping @Sendable () async -> Void) } -#if swift(>=5.8) && os(Linux) || swift(>=5.9) +#if os(Linux) || swift(>=5.9) @available(macOS 14.0, iOS 17.0, tvOS 17.0, watchOS 10.0, *) extension DiscardingTaskGroup: TaskGroupProtocol { @inlinable diff --git a/Sources/PostgresNIO/New/NotificationListener.swift b/Sources/PostgresNIO/New/NotificationListener.swift index 9e47ff34..4982b8ad 100644 --- a/Sources/PostgresNIO/New/NotificationListener.swift +++ b/Sources/PostgresNIO/New/NotificationListener.swift @@ -142,7 +142,7 @@ final class NotificationListener: @unchecked Sendable { } -#if swift(<5.9) +#if compiler(<5.9) // Async stream API backfill extension AsyncThrowingStream { static func makeStream( diff --git a/Sources/PostgresNIO/Utilities/Exports.swift b/Sources/PostgresNIO/Utilities/Exports.swift index 58e12891..144ff3c9 100644 --- a/Sources/PostgresNIO/Utilities/Exports.swift +++ b/Sources/PostgresNIO/Utilities/Exports.swift @@ -1,14 +1,3 @@ -#if swift(>=5.8) - @_documentation(visibility: internal) @_exported import NIO @_documentation(visibility: internal) @_exported import NIOSSL @_documentation(visibility: internal) @_exported import struct Logging.Logger - -#else - -// TODO: Remove this with the next major release! -@_exported import NIO -@_exported import NIOSSL -@_exported import struct Logging.Logger - -#endif