Improve:return 0 instead of Int.max when speedtest fail during jsbridge api

This commit is contained in:
yicheng 2018-12-21 09:49:23 +08:00
parent 8a65481831
commit cc9d3f23f2

View File

@ -99,7 +99,14 @@ class JsBridgeUtil {
bridge.registerHandler("speedTest") { (anydata, responseCallback) in
if let proxyName = anydata as? String {
ApiRequest.getProxyDelay(proxyName: proxyName) { (delay) in
SpeedDataRecorder.shared.speedDict[proxyName] = delay
var resp:Int
if delay == Int.max {
resp = 0
} else {
resp = delay
}
SpeedDataRecorder.shared.speedDict[proxyName] = resp
responseCallback?(delay)
}
} else {