Skip to content

Commit c076d6a

Browse files
authored
fix: websocket deadlock for high amounts of concurrency (#141)
* fix: send websocket request only when promise was set * fix: only decode once for path decision * fix: concurrency issue with websocket send * fix: websocket wait for response before continuing * fix: async exec receive ws messages * fix: increase max frame size * fix: single threaded ws group * fix: sometimes websocket was not initialized * fix: revert to 4 threads * fix: avoid deadlock by having multiple seperate queues * fix: switch from semaphores to closures * fix: do not send from queue * fix: do not access synchronized array synchronously
1 parent eff1a97 commit c076d6a

File tree

2 files changed

+164
-133
lines changed

2 files changed

+164
-133
lines changed

Sources/Core/Toolbox/SynchronizedDictionary.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ public final class SynchronizedDictionary<KeyType: Hashable, ValueType>: Sequenc
8282
}
8383
}
8484

85+
public func getValueAsync(key: KeyType, response: @escaping (_ value: ValueType?) -> Void) {
86+
accessQueue.async {
87+
response(self.internalDictionary[key])
88+
}
89+
}
90+
8591
private func setValue(value: ValueType?, forKey key: KeyType) {
8692
accessQueue.async(flags: .barrier) {
8793
self.internalDictionary[key] = value

0 commit comments

Comments
 (0)