Skip to content

Commit

Permalink
Removed warnings (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
Henryforce authored Jan 27, 2024
1 parent c263105 commit c0112a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Sources/AsyncWebSocketClient/AsyncWebSocketClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ public actor AsyncWebSocketClient: NSObject, AsyncWebSocketClientProtocol {
/// A debouncing behavior is implemented to send a ping-pong every time after 20 seconds
/// have elapsed since the last time an event happened or this function was initially called.
func startPingPongHandler() {
Task { [weak self] in
guard let stream = await self?.streamGenerator.subscribe() else { return }
Task { [weak self, streamGenerator, scheduler] in
let stream = await streamGenerator.subscribe()

let debouncedStream = stream.debounce(for: Constants.debounceTime, scheduler: scheduler)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import Foundation

// OPTIONAL TODO: move to a different package

actor StreamGenerator<T> {
var subscribers = [UUID: AsyncStream<T>.Continuation]()

Expand Down Expand Up @@ -48,18 +46,7 @@ actor StreamGenerator<T> {
for key in subscribers.keys {
guard let subscriber = subscribers[key] else { continue }
subscriber.finish()
removeSubscriber(with: key)
subscribers.removeValue(forKey: key)
}
}
}

//public protocol WriteStreamGenerator: Actor {
// associatedtype Value
// func updateValue(_ value: Value)
//}
//
//public protocol ReadStreamGenerator: Actor {
// associatedtype Value
// var value: Value { get }
// func subscribe() -> AsyncStream<Value>
//}

0 comments on commit c0112a9

Please sign in to comment.