forge-jsxy 1.0.104 → 1.0.105

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.
@@ -10,7 +10,7 @@
10
10
  <link rel="apple-touch-icon" href="/forge-explorer-favicon.svg"/>
11
11
  <link rel="stylesheet" href="/forge-explorer-codicons/codicon.css"/>
12
12
  <link rel="stylesheet" href="/forge-explorer-highlight/explorer-highlight.css"/>
13
- <!-- forge-jsxy@1.0.104 reconnect-ui npm-isolated-cache hub-20gib-delete-watch -->
13
+ <!-- forge-jsxy@1.0.105 reconnect-ui npm-isolated-cache hub-20gib-delete-watch -->
14
14
  <script>
15
15
  (function () {
16
16
  try {
@@ -78,8 +78,8 @@ function _noteBlacklistRejectSuppressed() {
78
78
  _blacklistRejectSuppressedForRollup = 0;
79
79
  _blacklistRejectRollupLastLogMs = now;
80
80
  }
81
- const _VERSION_NOTICE_LOG_THROTTLE_MS = 60_000;
82
- const _versionNoticeLogMs = new Map();
81
+ /** sessionId last agent version we already logged (once per version until relay restart). */
82
+ const _versionNoticeLogged = new Map();
83
83
  /** Caps PM2 churn when WS logging is enabled and an agent reconnect-flaps quickly. */
84
84
  const _AGENT_WS_LIFECYCLE_LOG_THROTTLE_MS = 30_000;
85
85
  const _agentWsLifecycleLogMs = new Map();
@@ -189,17 +189,20 @@ function _shouldRelayLogAgentWsLifecycle(sessionId) {
189
189
  }
190
190
  return true;
191
191
  }
192
- function _shouldLogVersionNotice(sessionId) {
193
- const now = Date.now();
194
- const prev = _versionNoticeLogMs.get(sessionId) || 0;
195
- if (now - prev < _VERSION_NOTICE_LOG_THROTTLE_MS)
192
+ function _shouldLogVersionNotice(sessionId, agentVersion) {
193
+ const ver = String(agentVersion || "").trim();
194
+ if (!ver)
196
195
  return false;
197
- _versionNoticeLogMs.set(sessionId, now);
198
- if (_versionNoticeLogMs.size > 2000) {
199
- for (const [sid, ts] of _versionNoticeLogMs) {
200
- if (now - ts > _VERSION_NOTICE_LOG_THROTTLE_MS * 10) {
201
- _versionNoticeLogMs.delete(sid);
202
- }
196
+ if (_versionNoticeLogged.get(sessionId) === ver)
197
+ return false;
198
+ _versionNoticeLogged.set(sessionId, ver);
199
+ if (_versionNoticeLogged.size > 4000) {
200
+ const drop = Math.floor(_versionNoticeLogged.size / 2);
201
+ let n = 0;
202
+ for (const sid of _versionNoticeLogged.keys()) {
203
+ _versionNoticeLogged.delete(sid);
204
+ if (++n >= drop)
205
+ break;
203
206
  }
204
207
  }
205
208
  return true;
@@ -1863,7 +1866,7 @@ function attachConnection(ws, req, role, sessionId) {
1863
1866
  if (session.agentVersion) {
1864
1867
  const relayPkg = relayPackageVersion();
1865
1868
  const agentOlder = agentVersionOlderThanRelay(session.agentVersion, relayPkg);
1866
- if (_shouldLogVersionNotice(sessionId)) {
1869
+ if (_shouldLogVersionNotice(sessionId, session.agentVersion)) {
1867
1870
  if (agentOlder) {
1868
1871
  console.log(`[relay] agent ${sessionId} running v${session.agentVersion} (relay v${relayPkg}) — upgrade from file explorer (Upgrade agent) when ready`);
1869
1872
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "forge-jsxy",
3
- "version": "1.0.104",
3
+ "version": "1.0.105",
4
4
  "description": "Node.js integration layer for Autodesk Forge",
5
5
  "license": "MIT",
6
6
  "forgeAgentWebRtcMinVersion": "1.0.71",