cli-setu 0.2.4 → 0.2.5
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 +1 -1
- package/src/supervisor.js +9 -12
package/package.json
CHANGED
package/src/supervisor.js
CHANGED
|
@@ -544,25 +544,22 @@ function flushOutputBuffer() {
|
|
|
544
544
|
|
|
545
545
|
// Still serialized against any send already in flight, so batches
|
|
546
546
|
// themselves can never arrive out of order relative to each other.
|
|
547
|
+
// Real bug found by testing: the Backend used to AWAIT Azure's own
|
|
548
|
+
// sendToAll broadcast (~190-200ms per call, confirmed inherent to
|
|
549
|
+
// Azure Web PubSub's broadcast API, not fixable from our side) before
|
|
550
|
+
// responding here - since this chain won't send its next batch until
|
|
551
|
+
// this fetch() resolves, every Azure call directly delayed the next
|
|
552
|
+
// batch too, compounding into real, visible lag during a burst of PTY
|
|
553
|
+
// output. auth-server.js's /relay/terminal-output now responds
|
|
554
|
+
// immediately and broadcasts to Azure in the background, so this
|
|
555
|
+
// fetch() itself should resolve quickly regardless of Azure's own cost.
|
|
547
556
|
sendInFlight = sendInFlight.then(async () => {
|
|
548
|
-
// TEMPORARY diagnostic (remove once the real lag source is found):
|
|
549
|
-
// measures the full fetch() round trip to the Backend, isolating "is
|
|
550
|
-
// the laptop's own network connection to the Backend slow" from
|
|
551
|
-
// Azure's broadcast time (measured separately, server-side, in
|
|
552
|
-
// auth-server.js's /relay/terminal-output handler) and from this
|
|
553
|
-
// batch's own BATCH_WINDOW_MS wait (not included here - that delay is
|
|
554
|
-
// intentional, not a bug).
|
|
555
|
-
const sendStart = Date.now();
|
|
556
557
|
try {
|
|
557
558
|
await fetch(`${AUTH_SERVER}/relay/terminal-output`, {
|
|
558
559
|
method: 'POST',
|
|
559
560
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${deviceToken}` },
|
|
560
561
|
body: JSON.stringify({ sessionId: SESSION_ID, seq: ++outputSeq, data: batch }),
|
|
561
562
|
});
|
|
562
|
-
const sendMs = Date.now() - sendStart;
|
|
563
|
-
if (sendMs > 150) {
|
|
564
|
-
log(`[perf] terminal-output POST took ${sendMs}ms (bytes=${batch.length})`);
|
|
565
|
-
}
|
|
566
563
|
} catch (err) {
|
|
567
564
|
// A dropped terminal.output batch isn't fatal the way a dropped
|
|
568
565
|
// confirmation would be - the next batch (or a fresh session.attach
|