22//
33// This source file is part of the RediStack open source project
44//
5- // Copyright (c) 2020 RediStack project authors
5+ // Copyright (c) 2020-2023 RediStack project authors
66// Licensed under Apache License v2.0
77//
88// See LICENSE.txt for license information
@@ -80,7 +80,7 @@ public class RedisConnectionPool {
8080 minimumConnectionCount: config. minimumConnectionCount,
8181 leaky: config. maximumConnectionCount. leaky,
8282 loop: boundEventLoop,
83- systemContext : config. poolDefaultLogger,
83+ backgroundLogger : config. poolDefaultLogger,
8484 connectionBackoffFactor: config. connectionRetryConfiguration. backoff. factor,
8585 initialConnectionBackoffDelay: config. connectionRetryConfiguration. backoff. initialDelay,
8686 connectionFactory: self . connectionFactory ( _: )
@@ -257,11 +257,11 @@ extension RedisConnectionPool: RedisClient {
257257 public var eventLoop : EventLoop { self . loop }
258258
259259 public func logging( to logger: Logger ) -> RedisClient {
260- return UserContextRedisClient ( client: self , context : self . prepareLoggerForUse ( logger) )
260+ return UserContextRedisClient ( client: self , logger : self . prepareLoggerForUse ( logger) )
261261 }
262262
263263 public func send( command: String , with arguments: [ RESPValue ] ) -> EventLoopFuture < RESPValue > {
264- return self . send ( command: command, with: arguments, context : nil )
264+ return self . send ( command: command, with: arguments, logger : nil )
265265 }
266266
267267 public func subscribe(
@@ -275,7 +275,7 @@ extension RedisConnectionPool: RedisClient {
275275 messageReceiver: receiver,
276276 onSubscribe: subscribeHandler,
277277 onUnsubscribe: unsubscribeHandler,
278- context : nil
278+ logger : nil
279279 )
280280 }
281281
@@ -290,33 +290,33 @@ extension RedisConnectionPool: RedisClient {
290290 messageReceiver: receiver,
291291 onSubscribe: subscribeHandler,
292292 onUnsubscribe: unsubscribeHandler,
293- context : nil
293+ logger : nil
294294 )
295295 }
296296
297297 public func unsubscribe( from channels: [ RedisChannelName ] ) -> EventLoopFuture < Void > {
298- return self . unsubscribe ( from: channels, context : nil )
298+ return self . unsubscribe ( from: channels, logger : nil )
299299 }
300300
301301 public func punsubscribe( from patterns: [ String ] ) -> EventLoopFuture < Void > {
302- return self . punsubscribe ( from: patterns, context : nil )
302+ return self . punsubscribe ( from: patterns, logger : nil )
303303 }
304304}
305305
306306// MARK: RedisClientWithUserContext conformance
307307extension RedisConnectionPool : RedisClientWithUserContext {
308- internal func send( command: String , with arguments: [ RESPValue ] , context : Logger ? ) -> EventLoopFuture < RESPValue > {
308+ internal func send( command: String , with arguments: [ RESPValue ] , logger : Logger ? ) -> EventLoopFuture < RESPValue > {
309309 return self . forwardOperationToConnection (
310310 { ( connection, returnConnection, context) in
311311
312312 connection. sendCommandsImmediately = true
313313
314314 return connection
315- . send ( command: command, with: arguments, context : context)
315+ . send ( command: command, with: arguments, logger : context)
316316 . always { _ in returnConnection ( connection, context) }
317317 } ,
318318 preferredConnection: nil ,
319- context: context
319+ context: logger
320320 )
321321 }
322322
@@ -325,7 +325,7 @@ extension RedisConnectionPool: RedisClientWithUserContext {
325325 messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver ,
326326 onSubscribe subscribeHandler: RedisSubscriptionChangeHandler ? ,
327327 onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler ? ,
328- context : Context ?
328+ logger : Logger ?
329329 ) -> EventLoopFuture < Void > {
330330 return self . subscribe (
331331 using: {
@@ -334,24 +334,24 @@ extension RedisConnectionPool: RedisClientWithUserContext {
334334 messageReceiver: receiver,
335335 onSubscribe: subscribeHandler,
336336 onUnsubscribe: $1,
337- context : $2
337+ logger : $2
338338 )
339339 } ,
340340 onUnsubscribe: unsubscribeHandler,
341- context: context
341+ context: logger
342342 )
343343 }
344344
345- internal func unsubscribe( from channels: [ RedisChannelName ] , context : Context ? ) -> EventLoopFuture < Void > {
346- return self . unsubscribe ( using: { $0. unsubscribe ( from: channels, context : $1) } , context: context )
345+ internal func unsubscribe( from channels: [ RedisChannelName ] , logger : Logger ? ) -> EventLoopFuture < Void > {
346+ return self . unsubscribe ( using: { $0. unsubscribe ( from: channels, logger : $1) } , context: logger )
347347 }
348348
349349 internal func psubscribe(
350350 to patterns: [ String ] ,
351351 messageReceiver receiver: @escaping RedisSubscriptionMessageReceiver ,
352352 onSubscribe subscribeHandler: RedisSubscriptionChangeHandler ? ,
353353 onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler ? ,
354- context : Context ?
354+ logger : Logger ?
355355 ) -> EventLoopFuture < Void > {
356356 return self . subscribe (
357357 using: {
@@ -360,22 +360,22 @@ extension RedisConnectionPool: RedisClientWithUserContext {
360360 messageReceiver: receiver,
361361 onSubscribe: subscribeHandler,
362362 onUnsubscribe: $1,
363- context : $2
363+ logger : $2
364364 )
365365 } ,
366366 onUnsubscribe: unsubscribeHandler,
367- context: context
367+ context: logger
368368 )
369369 }
370370
371- internal func punsubscribe( from patterns: [ String ] , context : Context ? ) -> EventLoopFuture < Void > {
372- return self . unsubscribe ( using: { $0. punsubscribe ( from: patterns, context : $1) } , context: context )
371+ internal func punsubscribe( from patterns: [ String ] , logger : Logger ? ) -> EventLoopFuture < Void > {
372+ return self . unsubscribe ( using: { $0. punsubscribe ( from: patterns, logger : $1) } , context: logger )
373373 }
374374
375375 private func subscribe(
376- using operation: @escaping ( RedisConnection , @escaping RedisSubscriptionChangeHandler , Context ) -> EventLoopFuture < Void > ,
376+ using operation: @escaping ( RedisConnection , @escaping RedisSubscriptionChangeHandler , Logger ) -> EventLoopFuture < Void > ,
377377 onUnsubscribe unsubscribeHandler: RedisSubscriptionChangeHandler ? ,
378- context: Context ?
378+ context: Logger ?
379379 ) -> EventLoopFuture < Void > {
380380 return self . forwardOperationToConnection (
381381 { ( connection, returnConnection, context) in
@@ -406,8 +406,8 @@ extension RedisConnectionPool: RedisClientWithUserContext {
406406 }
407407
408408 private func unsubscribe(
409- using operation: @escaping ( RedisConnection , Context ) -> EventLoopFuture < Void > ,
410- context: Context ?
409+ using operation: @escaping ( RedisConnection , Logger ) -> EventLoopFuture < Void > ,
410+ context: Logger ?
411411 ) -> EventLoopFuture < Void > {
412412 return self . forwardOperationToConnection (
413413 { ( connection, returnConnection, context) in
@@ -430,9 +430,9 @@ extension RedisConnectionPool: RedisClientWithUserContext {
430430
431431 @usableFromInline
432432 internal func forwardOperationToConnection< T> (
433- _ operation: @escaping ( RedisConnection , @escaping ( RedisConnection , Context ) -> Void , Context ) -> EventLoopFuture < T > ,
433+ _ operation: @escaping ( RedisConnection , @escaping ( RedisConnection , Logger ) -> Void , Logger ) -> EventLoopFuture < T > ,
434434 preferredConnection: RedisConnection ? ,
435- context: Context ?
435+ context: Logger ?
436436 ) -> EventLoopFuture < T > {
437437 // Establish event loop context then jump to the in-loop version.
438438 guard self . loop. inEventLoop else {
0 commit comments