@feigi/fleet-ctl 3.144.0 → 3.144.1
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/scripts/closeout.mjs +6 -3
package/package.json
CHANGED
package/scripts/closeout.mjs
CHANGED
|
@@ -601,13 +601,16 @@ function readCi(n, cwd, timeoutMs) {
|
|
|
601
601
|
// call's start, reads the PR every POLL_MS, sleeps only while READ_MS is left
|
|
602
602
|
// after the sleep for the reads that follow it, and stops waiting BOUND_MS
|
|
603
603
|
// after its first run. CLOSEOUT_CALL_MS and CLOSEOUT_POLL_MS can only shorten
|
|
604
|
-
// theirs.
|
|
604
|
+
// theirs. CLOSEOUT_POLLS, a positive integer, is the most passes the step makes
|
|
605
|
+
// in one call, a pass whose read fails included; anything else is no cap. Like
|
|
606
|
+
// the other two, it can only end the wait sooner.
|
|
605
607
|
const shorter = (name, ms) => {
|
|
606
608
|
const v = Number(process.env[name]);
|
|
607
609
|
return Number.isInteger(v) && v > 0 && v < ms ? v : ms;
|
|
608
610
|
};
|
|
609
611
|
const CALL_MS = shorter("CLOSEOUT_CALL_MS", 4 * 60_000);
|
|
610
612
|
const POLL_MS = shorter("CLOSEOUT_POLL_MS", 30_000);
|
|
613
|
+
const POLLS = shorter("CLOSEOUT_POLLS", Infinity);
|
|
611
614
|
const READ_MS = CALL_MS / 8;
|
|
612
615
|
const BOUND_MS = 30 * 60_000;
|
|
613
616
|
const BOUND = "the 30-min bound";
|
|
@@ -658,7 +661,7 @@ function stepMerge({ receipt, save, started }) {
|
|
|
658
661
|
// What the call's one `gh pr merge` answered, kept for every later poll so a
|
|
659
662
|
// failed merge's own words reach the NEED line and the bound.
|
|
660
663
|
let asked = null;
|
|
661
|
-
|
|
664
|
+
for (let passes = 1; Date.now() < deadline; passes++) {
|
|
662
665
|
const pr = readPr(n, cwd, budget());
|
|
663
666
|
if (pr.unreadable) last = { at: "gh unreadable until the bound", why: pr.unreadable };
|
|
664
667
|
else if (pr.state === "MERGED") return merged(pr.headRefOid);
|
|
@@ -683,7 +686,7 @@ function stepMerge({ receipt, save, started }) {
|
|
|
683
686
|
}
|
|
684
687
|
}
|
|
685
688
|
if (Date.now() >= bound) return atBound(last);
|
|
686
|
-
if (Date.now() + POLL_MS + READ_MS >= deadline) break;
|
|
689
|
+
if (passes >= POLLS || Date.now() + POLL_MS + READ_MS >= deadline) break;
|
|
687
690
|
Atomics.wait(IDLE, 0, 0, POLL_MS);
|
|
688
691
|
}
|
|
689
692
|
if (Date.now() >= bound) return atBound(last);
|