diff --git a/ActionCableClient.podspec b/ActionCableClient.podspec index bc4dae1..9b4521d 100644 --- a/ActionCableClient.podspec +++ b/ActionCableClient.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "ActionCableClient" - s.version = "0.1.4" + s.version = "0.1.5" s.summary = "A Swift client for the Rails ActionCable WebSocket server." s.description = <<-DESC ActionCable is a new WebSocket server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going. diff --git a/Pod/Classes/RetryHandler.swift b/Pod/Classes/RetryHandler.swift index 2a0bd54..cb98106 100644 --- a/Pod/Classes/RetryHandler.swift +++ b/Pod/Classes/RetryHandler.swift @@ -34,11 +34,11 @@ public enum RetryStrategy { case .LogarithmicBackoff(let maxRetries, let maxIntervalTime): if (retries > maxRetries) { return 0.0 } let interval = 5 * log(Double(retries)) - return NSTimeInterval(clamp(interval, lower: 0.0, upper: Double(maxIntervalTime))) + return NSTimeInterval(clamp(interval, lower: 0.1, upper: Double(maxIntervalTime))) case .ExponentialBackoff(let maxRetries, let maxIntervalTime): if (retries > maxRetries) { return 0.0 } let interval = exp2(Double(retries)) - return NSTimeInterval(clamp(Double(interval), lower: 0.0, upper: Double(maxIntervalTime))) + return NSTimeInterval(clamp(Double(interval), lower: 0.1, upper: Double(maxIntervalTime))) case .Linear(let maxRetries, let intervalTime): if (retries > maxRetries) { return 0.0 } return NSTimeInterval(intervalTime) @@ -72,13 +72,14 @@ internal class RetryHandler : NSObject { if (interval > 0.0) { self.timer = NSTimer.scheduledTimerWithTimeInterval(interval, target: self, - selector: #selector(RetryHandler.fire(_:)), + selector: #selector(self.fire(_:)), userInfo: nil, repeats: false) } } internal func fire(timer : NSTimer) { + if let callback = self.callback { callback() }