libp2r2p 0.12.20 → 0.12.21
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.
package/package.json
CHANGED
|
@@ -1939,11 +1939,13 @@ export class PrivateMessenger {
|
|
|
1939
1939
|
}
|
|
1940
1940
|
|
|
1941
1941
|
recordInterruption (channels, at = nowSeconds()) {
|
|
1942
|
+
const now = nowSeconds()
|
|
1943
|
+
const eventTime = Number.isSafeInteger(at) && at >= 0 ? Math.min(at, now) : now
|
|
1942
1944
|
const state = this.readState()
|
|
1943
1945
|
for (const pubkey of channels) {
|
|
1944
1946
|
if (!this.offlineRecoverySecondsFor(pubkey)) continue
|
|
1945
1947
|
const current = state.channels[pubkey] || {}
|
|
1946
|
-
const start = Math.max(0,
|
|
1948
|
+
const start = Math.max(0, eventTime - this.offlineSkewSeconds)
|
|
1947
1949
|
current.openOfflineStart = Math.min(current.openOfflineStart ?? start, start)
|
|
1948
1950
|
state.channels[pubkey] = current
|
|
1949
1951
|
}
|
|
@@ -2513,7 +2515,10 @@ export class PrivateMessenger {
|
|
|
2513
2515
|
if (this.pauseReasons.has('capacity')) throw this.pausedError()
|
|
2514
2516
|
const capacity = await this.queue.getCapacity()
|
|
2515
2517
|
if (capacity.usedBytes >= inboxCapacityLimits(capacity.maxBytes).highWaterBytes) {
|
|
2516
|
-
throw await this.beginCapacityPressure(capacity
|
|
2518
|
+
throw await this.beginCapacityPressure(capacity, {
|
|
2519
|
+
channelPubkey,
|
|
2520
|
+
interruptionAt: messageTime(message)
|
|
2521
|
+
})
|
|
2517
2522
|
}
|
|
2518
2523
|
const record = {
|
|
2519
2524
|
type,
|
|
@@ -2782,7 +2787,8 @@ export class PrivateMessenger {
|
|
|
2782
2787
|
}
|
|
2783
2788
|
}
|
|
2784
2789
|
|
|
2785
|
-
async beginCapacityPressure (capacity) {
|
|
2790
|
+
async beginCapacityPressure (capacity, { channelPubkey, interruptionAt = nowSeconds() } = {}) {
|
|
2791
|
+
if (channelPubkey) this.recordInterruption([channelPubkey], interruptionAt)
|
|
2786
2792
|
this.applyCapacityRecoveryTarget(capacity)
|
|
2787
2793
|
const pause = this.pauseReasons.has('capacity') ? null : this.pause('capacity')
|
|
2788
2794
|
pause?.catch(error => this.onError?.(error))
|