@tokamakdev/platform-macos-arm64 0.1.1-beta.131 → 0.1.1-beta.133
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -438,14 +438,14 @@ func tokamakResource(
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
/// How many values
|
|
442
|
-
|
|
443
|
-
private let listenerCapacity = 64
|
|
441
|
+
/// How many values wait for the first listener.
|
|
442
|
+
private let heldCapacity = 64
|
|
444
443
|
|
|
445
444
|
/// The streams of an event's listeners, such as a page's, each of which
|
|
446
|
-
/// receives every value `send` delivers until it ends
|
|
447
|
-
///
|
|
448
|
-
///
|
|
445
|
+
/// receives every value `send` delivers until it ends. A stream keeps every
|
|
446
|
+
/// value its reader has not taken, so a Worker's subscription applies its own
|
|
447
|
+
/// overflow policy. When `holding`, the newest 64 values sent while none
|
|
448
|
+
/// listen wait for the first listener.
|
|
449
449
|
final class TokamakListeners<Value>: @unchecked Sendable {
|
|
450
450
|
private let lock = NSLock()
|
|
451
451
|
private let holding: Bool
|
|
@@ -460,8 +460,7 @@ final class TokamakListeners<Value>: @unchecked Sendable {
|
|
|
460
460
|
// Values are yielded under the lock, so one sent while a listener starts
|
|
461
461
|
// follows the held ones. Yielding only buffers.
|
|
462
462
|
func stream() -> AsyncStream<Value> {
|
|
463
|
-
let (stream, continuation) = AsyncStream.makeStream(
|
|
464
|
-
of: Value.self, bufferingPolicy: .bufferingNewest(listenerCapacity))
|
|
463
|
+
let (stream, continuation) = AsyncStream.makeStream(of: Value.self)
|
|
465
464
|
let key = UUID()
|
|
466
465
|
continuation.onTermination = { [weak self] _ in
|
|
467
466
|
self?.lock.withLock { _ = self?.continuations.removeValue(forKey: key) }
|
|
@@ -480,7 +479,7 @@ final class TokamakListeners<Value>: @unchecked Sendable {
|
|
|
480
479
|
lock.withLock {
|
|
481
480
|
if holding && continuations.isEmpty {
|
|
482
481
|
held.append(value)
|
|
483
|
-
if held.count >
|
|
482
|
+
if held.count > heldCapacity { held.removeFirst() }
|
|
484
483
|
}
|
|
485
484
|
for continuation in continuations.values {
|
|
486
485
|
continuation.yield(value)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/macos-arm64/tools/tokamak-swift-describe
|
|
3
3
|
size: 34569672 bytes
|
|
4
|
-
sha256:
|
|
4
|
+
sha256: e8be5ae9a59d746b915b419a1738cffa7060229b3175841f8fe17ff5bfdb7e36
|