Compare commits
1 Commits
main
...
fix/serial
Author | SHA1 | Date |
---|---|---|
![]() |
63d2cac4c1 |
|
@ -32,6 +32,7 @@ extension AppSyncSubscriptionConnection {
|
|||
let connectionError = error as? ConnectionProviderError
|
||||
else {
|
||||
subscriptionItem.subscriptionEventHandler(.failed(error), subscriptionItem)
|
||||
connectionProvider?.removeListener(identifier: subscriptionItem.identifier)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -43,6 +44,7 @@ extension AppSyncSubscriptionConnection {
|
|||
}
|
||||
} else {
|
||||
subscriptionItem.subscriptionEventHandler(.failed(error), subscriptionItem)
|
||||
connectionProvider?.removeListener(identifier: subscriptionItem.identifier)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ public class AppSyncSubscriptionConnection: SubscriptionConnection, RetryableCon
|
|||
/// Retry logic to handle
|
||||
var retryHandler: ConnectionRetryHandler?
|
||||
|
||||
let serialQueue = DispatchQueue(
|
||||
label: "com.amazonaws.AppSyncSubscriptionConnection.serialQueue"
|
||||
)
|
||||
|
||||
public init(provider: ConnectionProvider) {
|
||||
self.connectionProvider = provider
|
||||
}
|
||||
|
@ -84,6 +88,7 @@ public class AppSyncSubscriptionConnection: SubscriptionConnection, RetryableCon
|
|||
AppSyncLogger.debug("[AppSyncSubscriptionConnection] \(#function): Self is nil, listener is not called.")
|
||||
return
|
||||
}
|
||||
self.serialQueue.async {
|
||||
switch event {
|
||||
case .connection(let state):
|
||||
self.handleConnectionEvent(connectionState: state)
|
||||
|
@ -94,6 +99,7 @@ public class AppSyncSubscriptionConnection: SubscriptionConnection, RetryableCon
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func addRetryHandler(handler: ConnectionRetryHandler) {
|
||||
retryHandler = handler
|
||||
|
|
Loading…
Reference in New Issue