libp2r2p 0.12.1 → 0.12.2
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/README.md
CHANGED
|
@@ -264,6 +264,8 @@ requests, uses an origin/identity Web Lock when available, and stops on pause or
|
|
|
264
264
|
close. Missing-key retries have no polling timer. MAC failures permit three total
|
|
265
265
|
attempts, persisted across reloads; exhausted packets remain until FIFO eviction.
|
|
266
266
|
`retryPendingDecryptions({ force: true })` explicitly retries exhausted packets.
|
|
267
|
+
Callers should request it when a committed content-key revision provides new
|
|
268
|
+
evidence, while startup, resume and routine reconciliation retain normal retries.
|
|
267
269
|
Success enters the normal acknowledged inbox before removing the pending item.
|
|
268
270
|
The session coordinator forwards this API.
|
|
269
271
|
|
package/package.json
CHANGED
|
@@ -48,6 +48,11 @@ function replaceErrorMetadata (item, error) {
|
|
|
48
48
|
return Object.assign(next, errorMetadata(error))
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
function createdAtMetadata (item) {
|
|
52
|
+
const value = item?.packet?.outer?.created_at ?? item?.outer?.created_at
|
|
53
|
+
return Number.isSafeInteger(value) ? { outerCreatedAt: value } : {}
|
|
54
|
+
}
|
|
55
|
+
|
|
51
56
|
export function pendingContentKeyGroup (item) {
|
|
52
57
|
const receiver = item?.receiverPubkey
|
|
53
58
|
const own = item?.ownContentPubkey
|
|
@@ -92,7 +97,7 @@ export async function createPendingDecryption ({ prefix, indexedDB, maxBytes = P
|
|
|
92
97
|
const notify = (action, detail) => {
|
|
93
98
|
report({ action, ...detail })
|
|
94
99
|
const key = `${action}:${detail.code || detail.reason || ''}`
|
|
95
|
-
counts[key] = { count: (counts[key]?.count || 0) + 1,
|
|
100
|
+
counts[key] = { count: (counts[key]?.count || 0) + 1, sample: detail }
|
|
96
101
|
if (!timer) { timer = setTimeout(flush, 1000); timer.unref?.() }
|
|
97
102
|
}
|
|
98
103
|
return {
|
|
@@ -129,7 +134,16 @@ export async function createPendingDecryption ({ prefix, indexedDB, maxBytes = P
|
|
|
129
134
|
if (evictedBytes) notify('discarded', { reason: 'capacity', bytes: evictedBytes })
|
|
130
135
|
const coordinates = Object.fromEntries(['eventId', 'eventKind', 'senderPubkey', 'receiverPubkey', 'ownContentPubkey', 'peerContentPubkey', 'hasOwnContentKey']
|
|
131
136
|
.filter(key => ['string', 'boolean', 'number'].includes(typeof error[key])).map(key => [key, error[key]]))
|
|
132
|
-
notify('deferred', {
|
|
137
|
+
notify('deferred', {
|
|
138
|
+
...coordinates,
|
|
139
|
+
...createdAtMetadata(record),
|
|
140
|
+
code: error.code,
|
|
141
|
+
stage: error.stage,
|
|
142
|
+
id,
|
|
143
|
+
channelPubkey: item.channelPubkey,
|
|
144
|
+
capacityBytesBefore: before.usedBytes,
|
|
145
|
+
capacityBytesAfter: after.usedBytes
|
|
146
|
+
})
|
|
133
147
|
return true
|
|
134
148
|
})
|
|
135
149
|
},
|
|
@@ -148,7 +162,7 @@ export async function createPendingDecryption ({ prefix, indexedDB, maxBytes = P
|
|
|
148
162
|
recovered (item) {
|
|
149
163
|
return serial(async () => {
|
|
150
164
|
await queue.removeBy('byId', item.id)
|
|
151
|
-
notify('recovered', { id: item.id, channelPubkey: item.channelPubkey })
|
|
165
|
+
notify('recovered', { id: item.id, channelPubkey: item.channelPubkey, ...createdAtMetadata(item) })
|
|
152
166
|
})
|
|
153
167
|
},
|
|
154
168
|
failed (item, error) {
|
|
@@ -161,7 +175,9 @@ export async function createPendingDecryption ({ prefix, indexedDB, maxBytes = P
|
|
|
161
175
|
macAttempts: current.macAttempts + (error.code === 'INVALID_MAC' ? 1 : 0)
|
|
162
176
|
}
|
|
163
177
|
await queue.putBy('byId', updated, { existingOnly: true })
|
|
164
|
-
if (updated.macAttempts >= 3 && item.macAttempts < 3)
|
|
178
|
+
if (updated.macAttempts >= 3 && item.macAttempts < 3) {
|
|
179
|
+
notify('suspended', { id: item.id, code: error.code, channelPubkey: item.channelPubkey, ...createdAtMetadata(updated) })
|
|
180
|
+
}
|
|
165
181
|
})
|
|
166
182
|
},
|
|
167
183
|
clearChannel: channel => serial(() => queue.removeBy('byChannel', channel)),
|