diff --git a/Moya+ReactiveCocoa.swift b/Moya+ReactiveCocoa.swift index fc1a2e7f9..027ddfe6c 100644 --- a/Moya+ReactiveCocoa.swift +++ b/Moya+ReactiveCocoa.swift @@ -70,13 +70,13 @@ public class ReactiveMoyaProvider: MoyaProvider { } } - return nil - }).finally({ [weak self] () -> Void in - if let weakSelf = self { - objc_sync_enter(weakSelf) - weakSelf.inflightRequests[endpoint] = nil - objc_sync_exit(weakSelf) - } + return RACDisposable(block: { () -> Void in + if let weakSelf = self { + objc_sync_enter(weakSelf) + weakSelf.inflightRequests[endpoint] = nil + objc_sync_exit(weakSelf) + } + }) }).publish().autoconnect() if let weakSelf = self {