MultiThreadedEventLoopGroup has been replaced with NIOTSEventLoopGroup. It's recommended by authors of grpc-swift especially for iOS platform and it allows us to set the priority because NIOTSEventLoopGroup is GCD based while MultiThreadedEventLoopGroup is pthread based. [#541] Initialise gRPC on a separate thread (#545) - priority increased to .default
This commit is contained in:
parent
46d8c04afc
commit
fa5bbbb2bf
|
@ -10,6 +10,7 @@ import Foundation
|
||||||
import GRPC
|
import GRPC
|
||||||
import NIO
|
import NIO
|
||||||
import NIOHPACK
|
import NIOHPACK
|
||||||
|
import NIOTransportServices
|
||||||
|
|
||||||
public typealias Channel = GRPC.GRPCChannel
|
public typealias Channel = GRPC.GRPCChannel
|
||||||
|
|
||||||
|
@ -127,8 +128,8 @@ public class LightWalletGRPCService {
|
||||||
self.singleCallTimeout = TimeLimit.timeout(.milliseconds(singleCallTimeout))
|
self.singleCallTimeout = TimeLimit.timeout(.milliseconds(singleCallTimeout))
|
||||||
|
|
||||||
let connectionBuilder = secure ?
|
let connectionBuilder = secure ?
|
||||||
ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads: 1)) :
|
ClientConnection.usingPlatformAppropriateTLS(for: NIOTSEventLoopGroup(loopCount: 1, defaultQoS: .default)) :
|
||||||
ClientConnection.insecure(group: MultiThreadedEventLoopGroup(numberOfThreads: 1))
|
ClientConnection.insecure(group: NIOTSEventLoopGroup(loopCount: 1, defaultQoS: .default))
|
||||||
|
|
||||||
let channel = connectionBuilder
|
let channel = connectionBuilder
|
||||||
.withConnectivityStateDelegate(connectionManager, executingOn: queue)
|
.withConnectivityStateDelegate(connectionManager, executingOn: queue)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import GRPC
|
||||||
import ZcashLightClientKit
|
import ZcashLightClientKit
|
||||||
import XCTest
|
import XCTest
|
||||||
import NIO
|
import NIO
|
||||||
|
import NIOTransportServices
|
||||||
|
|
||||||
enum Environment {
|
enum Environment {
|
||||||
static let lightwalletdKey = "LIGHTWALLETD_ADDRESS"
|
static let lightwalletdKey = "LIGHTWALLETD_ADDRESS"
|
||||||
|
@ -40,8 +41,8 @@ class ChannelProvider {
|
||||||
let endpoint = LightWalletEndpointBuilder.default
|
let endpoint = LightWalletEndpointBuilder.default
|
||||||
|
|
||||||
let connectionBuilder = secure ?
|
let connectionBuilder = secure ?
|
||||||
ClientConnection.usingPlatformAppropriateTLS(for: MultiThreadedEventLoopGroup(numberOfThreads: 1)) :
|
ClientConnection.usingPlatformAppropriateTLS(for: NIOTSEventLoopGroup(loopCount: 1, defaultQoS: .default)) :
|
||||||
ClientConnection.insecure(group: MultiThreadedEventLoopGroup(numberOfThreads: 1))
|
ClientConnection.insecure(group: NIOTSEventLoopGroup(loopCount: 1, defaultQoS: .default))
|
||||||
|
|
||||||
let channel = connectionBuilder
|
let channel = connectionBuilder
|
||||||
.withKeepalive(
|
.withKeepalive(
|
||||||
|
|
Loading…
Reference in New Issue