Vexil
Vexil copied to clipboard
Occasional hang if used in an extension that is initialised multiple times
Vexil version: 2.2.0
Swift version: swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Environment: Xcode 13.2.1 – Xcode 13.4
✅ Checklist
- [x] If possible, I've reproduced the issue using the
mainbranch of this package - [x] I've searched for existing GitHub issues
🔢 Description
When using Vexil with an extension that could see the Process initialised multiple times (such as Apple Pay), the following line occasionally hangs:
private func setupSnapshotPublishing (keys: Set<String>, sendImmediately: Bool, changedSources: [String]? = nil) {
guard self.shouldSetupSnapshotPublishing else { return }
self.cancellables.forEach { $0.cancel() }
self.cancellables.removeAll() // hang here
This hang does not occur if we remove the manual calls to AnyCancellable.cancel(). As noted in AnyCancellable the cancel() function is called on deinit anyway, so the manual call to cancel() is not required. We should remove it.