@@ -27,8 +27,9 @@ extension ValkeyConnection {
2727 /// - process: Closure that is called with subscription async sequence
2828 /// - Returns: Return value of closure
2929 @inlinable
30- public func subscribe< Value> (
30+ public func subscribe< Value: Sendable > (
3131 to channels: String ... ,
32+ isolation: isolated ( any Actor ) ? = #isolation,
3233 process: ( ValkeySubscriptionSequence ) async throws -> Value
3334 ) async throws -> Value {
3435 try await self . subscribe ( to: channels, process: process)
@@ -46,7 +47,11 @@ extension ValkeyConnection {
4647 /// - channels: list of channels to subscribe to
4748 /// - process: Closure that is called with subscription async sequence
4849 /// - Returns: Return value of closure
49- public func subscribe< Value> ( to channels: [ String ] , process: ( ValkeySubscriptionSequence ) async throws -> Value ) async throws -> Value {
50+ public func subscribe< Value: Sendable > (
51+ to channels: [ String ] ,
52+ isolation: isolated ( any Actor ) ? = #isolation,
53+ process: ( ValkeySubscriptionSequence ) async throws -> Value
54+ ) async throws -> Value {
5055 let command = SUBSCRIBE ( channel: channels)
5156 let ( id, stream) = try await subscribe ( command: command, filters: channels. map { . channel( $0) } )
5257 let value : Value
@@ -72,8 +77,9 @@ extension ValkeyConnection {
7277 /// - process: Closure that is called with subscription async sequence
7378 /// - Returns: Return value of closure
7479 @inlinable
75- public func psubscribe< Value> (
80+ public func psubscribe< Value: Sendable > (
7681 to patterns: String ... ,
82+ isolation: isolated ( any Actor ) ? = #isolation,
7783 process: ( ValkeySubscriptionSequence ) async throws -> Value
7884 ) async throws -> Value {
7985 try await self . psubscribe ( to: patterns, process: process)
@@ -91,7 +97,11 @@ extension ValkeyConnection {
9197 /// - process: Closure that is called with subscription async sequence
9298 /// - Returns: Return value of closure
9399 @inlinable
94- public func psubscribe< Value> ( to patterns: [ String ] , process: ( ValkeySubscriptionSequence ) async throws -> Value ) async throws -> Value {
100+ public func psubscribe< Value: Sendable > (
101+ to patterns: [ String ] ,
102+ isolation: isolated ( any Actor ) ? = #isolation,
103+ process: ( ValkeySubscriptionSequence ) async throws -> Value
104+ ) async throws -> Value {
95105 let command = PSUBSCRIBE ( pattern: patterns)
96106 let ( id, stream) = try await subscribe ( command: command, filters: patterns. map { . pattern( $0) } )
97107 let value : Value
@@ -117,8 +127,9 @@ extension ValkeyConnection {
117127 /// - process: Closure that is called with subscription async sequence
118128 /// - Returns: Return value of closure
119129 @inlinable
120- public func ssubscribe< Value> (
130+ public func ssubscribe< Value: Sendable > (
121131 to shardchannel: String ... ,
132+ isolation: isolated ( any Actor ) ? = #isolation,
122133 process: ( ValkeySubscriptionSequence ) async throws -> Value
123134 ) async throws -> Value {
124135 try await self . ssubscribe ( to: shardchannel, process: process)
@@ -136,7 +147,11 @@ extension ValkeyConnection {
136147 /// - process: Closure that is called with subscription async sequence
137148 /// - Returns: Return value of closure
138149 @inlinable
139- public func ssubscribe< Value> ( to shardchannel: [ String ] , process: ( ValkeySubscriptionSequence ) async throws -> Value ) async throws -> Value {
150+ public func ssubscribe< Value: Sendable > (
151+ to shardchannel: [ String ] ,
152+ isolation: isolated ( any Actor ) ? = #isolation,
153+ process: ( ValkeySubscriptionSequence ) async throws -> Value
154+ ) async throws -> Value {
140155 let command = SSUBSCRIBE ( shardchannel: shardchannel)
141156 let ( id, stream) = try await subscribe ( command: command, filters: shardchannel. map { . shardChannel( $0) } )
142157 let value : Value
0 commit comments