appmesh 3.1.5 → 3.1.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/appmesh_tcp.js +11 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appmesh",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "JavaScript SDK for App Mesh (https://github.com/laoshanxi/app-mesh)",
5
5
  "main": "./src/appmesh.js",
6
6
  "module": "./dist/appmesh.esm.js",
@@ -763,6 +763,7 @@ class AppMeshClientTCP extends AppMeshClient {
763
763
 
764
764
  let exitCode = null
765
765
  let failure = null
766
+ let disconnected = false // transport died — skip unsubscribe cleanup (SDKContract cleanup policy)
766
767
  let deliveredUntil = 0 // next-byte offset already delivered
767
768
  let done = false
768
769
  let resolveWait
@@ -807,6 +808,7 @@ class AppMeshClientTCP extends AppMeshClient {
807
808
  done = true
808
809
  resolveWait()
809
810
  } else if (event.event_type === EVENT_TYPE_DISCONNECTED) {
811
+ disconnected = true
810
812
  if (exitCode === null && failure === null) {
811
813
  failure = new TransportDisconnectedError(`transport disconnected while waiting for '${run.appName}' to exit`)
812
814
  }
@@ -844,11 +846,15 @@ class AppMeshClientTCP extends AppMeshClient {
844
846
  }
845
847
  }
846
848
  } finally {
847
- try {
848
- if (sub && sub.subscription_id) {
849
- await this.unsubscribe(sub.subscription_id)
850
- }
851
- } catch (_) { /* ignore */ }
849
+ // Cleanup policy: after a disconnect the transport is dead — an unsubscribe
850
+ // would silently reconnect and register a never-answered waiter.
851
+ if (!disconnected) {
852
+ try {
853
+ if (sub && sub.subscription_id) {
854
+ await this.unsubscribe(sub.subscription_id)
855
+ }
856
+ } catch (_) { /* ignore */ }
857
+ }
852
858
 
853
859
  // Best-effort delete on a real exit; on REMOVED/disconnect the app is already gone.
854
860
  if (exitCode !== null && failure === null) {