@kubun/plugin-p2p 0.17.3 → 0.17.4

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.
@@ -326,8 +326,9 @@ function rethrowHubError(error) {
326
326
  // dropped channel never surfaces as an unhandled rejection — and keep the
327
327
  // reason, because a refusal is visible ONLY here: an error reply rejects the
328
328
  // call and closes the readable, so the drain below sees a clean end. The
329
- // rejection is queued before that close, so it is recorded by the time the
330
- // drain exits.
329
+ // rejection and the close race, so the drain re-awaits this call before
330
+ // classifying the end (see `#runReceiveLoop`) rather than assuming the
331
+ // rejection has already landed here.
331
332
  this.#channelFailure = null;
332
333
  void channel.catch((error)=>{
333
334
  this.#channelFailure = error;
@@ -522,6 +523,15 @@ function rethrowHubError(error) {
522
523
  // report.
523
524
  const superseded = this.#channel !== channel;
524
525
  if (!this.#controller.signal.aborted && !this.#disposed && !superseded) {
526
+ // A refused channel rejects its call promise AND closes its readable. The
527
+ // drain sees the close first, so the rejection may not have propagated to
528
+ // `#channelFailure` yet — awaiting the call here settles it before we read
529
+ // it. Without this, the refusal that reached the drain as a clean end is
530
+ // classified as a plain disconnect, `onAccessDenied` never fires, and a
531
+ // stale hub audience is never refreshed.
532
+ if (caughtError == null && this.#channelFailure == null) {
533
+ await channel.catch(()=>{});
534
+ }
525
535
  const refusal = caughtError ?? this.#channelFailure;
526
536
  const reason = refusal instanceof Error && refusal.message ? refusal.message : 'receive loop ended';
527
537
  this.#logger?.debug('hub-like receive loop ended, scheduling reconnect', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubun/plugin-p2p",
3
- "version": "0.17.3",
3
+ "version": "0.17.4",
4
4
  "license": "see LICENSE.md",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "@kubun/credential": "^0.17.0",
27
27
  "@kubun/db": "^0.17.0",
28
28
  "@kubun/db-adapter": "^0.17.0",
29
- "@kubun/engine": "^0.17.0",
29
+ "@kubun/engine": "^0.17.1",
30
30
  "@kubun/graphql": "^0.17.1",
31
31
  "@kubun/hlc": "^0.17.0",
32
32
  "@kubun/http-util": "^0.17.0",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "devDependencies": {
70
70
  "@kubun/blob-backend": "^0.17.0",
71
- "@kubun/client": "^0.17.0",
71
+ "@kubun/client": "^0.17.1",
72
72
  "@kubun/db-better-sqlite": "^0.17.0",
73
73
  "@kubun/db-node-sqlite": "^0.17.0",
74
74
  "@kubun/db-postgres": "^0.17.0",
@@ -77,7 +77,7 @@
77
77
  "@kubun/plugin-connector": "^0.17.1",
78
78
  "@kubun/plugin-service-server": "^0.17.0",
79
79
  "@kubun/plugin-workflow": "^0.17.0",
80
- "@kubun/service-graph-api": "^0.17.0",
80
+ "@kubun/service-graph-api": "^0.17.1",
81
81
  "@kubun/store-workflow": "^0.17.0",
82
82
  "@kubun/test-utils": "^0.0.0",
83
83
  "@kumiai/hub-conformance": "^0.9.0",