@volter/supercode-teams 0.2.46 → 0.2.47
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/connector/index.mjs +7 -2
- package/package.json +1 -1
package/connector/index.mjs
CHANGED
|
@@ -443,7 +443,10 @@ export class TeamsConnector {
|
|
|
443
443
|
}
|
|
444
444
|
async runLargeLane(){
|
|
445
445
|
while(this.largeQueue.size&&!this.abort.signal.aborted){
|
|
446
|
-
|
|
446
|
+
// The session written most recently goes first: a watched live session never waits behind a slow old one.
|
|
447
|
+
const written=([,item])=>{try{return statSync(realpathSync(item.locator.storage.path)).mtimeMs;}catch{return 0;}};
|
|
448
|
+
const [key,options]=[...this.largeQueue.entries()].reduce((best,entry)=>written(entry)>written(best)?entry:best);this.largeQueue.delete(key);
|
|
449
|
+
let started=null;
|
|
447
450
|
try{
|
|
448
451
|
const artifactBefore=statSync(realpathSync(options.locator.storage.path));
|
|
449
452
|
// A session is loaded again no sooner than ten times its last load took (a 0.7 s load: every 7 s; a load
|
|
@@ -451,12 +454,14 @@ export class TeamsConnector {
|
|
|
451
454
|
// A change that arrives sooner is captured when its wait ends.
|
|
452
455
|
this.largeCaptures??=new Map();const last=this.largeCaptures.get(key),wait=last?Math.min(LARGE_CAPTURE_EVERY_MS,last.ms*10)-(this.clock.nowMs()-last.at):0;
|
|
453
456
|
if(wait>0){this.largeRetry??=new Map();if(!this.largeRetry.has(key))this.largeRetry.set(key,setTimeout(()=>{this.largeRetry.delete(key);this.captureLarge(options);},wait).unref?.());continue;}
|
|
454
|
-
|
|
457
|
+
started=this.clock.nowMs();
|
|
455
458
|
const loaded=await this.core.session(options.locator).load({timeoutMs:Math.max(30000,Math.ceil(artifactBefore.size/(1024*1024))*1000)});
|
|
456
459
|
this.largeCaptures.set(key,{at:started,ms:this.clock.nowMs()-started});
|
|
457
460
|
await this.capture({...options,preloaded:{loaded,artifactBefore}});
|
|
458
461
|
}catch(error){
|
|
459
462
|
if(this.abort.signal.aborted)return;
|
|
463
|
+
// A load that failed or timed out waits like a slow one, so it does not hold the lane on every pass.
|
|
464
|
+
if(started!==null)this.largeCaptures.set(key,{at:started,ms:this.clock.nowMs()-started});
|
|
460
465
|
this.noteSessionProblem(options,error);
|
|
461
466
|
process.stderr.write(`supercode teams: ${options.harness} session ${options.nativeSessionId} not synced: ${error.message}\n`);
|
|
462
467
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.47",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|