Skip to content

Commit fb3afb9

Browse files
committed
Share event-loop-group between client connections
... if the client is free-standing (not invoked from an existing eventloop), use a shared group.
1 parent 3d4e01c commit fb3afb9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/Redis/RedisClientOptions.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
import NIO
1616

17+
fileprivate let onDemandSharedEventLoopGroup =
18+
MultiThreadedEventLoopGroup(numThreads: 1)
19+
1720
/// Configuration options for the socket connects
1821
open class ConnectOptions : CustomStringConvertible {
1922

@@ -28,7 +31,7 @@ open class ConnectOptions : CustomStringConvertible {
2831
self.port = port
2932
self.eventLoopGroup = eventLoopGroup
3033
?? MultiThreadedEventLoopGroup.currentEventLoop
31-
?? MultiThreadedEventLoopGroup(numThreads: 1)
34+
?? onDemandSharedEventLoopGroup
3235
}
3336

3437
public var description: String {

0 commit comments

Comments
 (0)