@fullstackhouse/cerber 1.5.0-pr.87.1fdc3c7 → 1.5.0
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/dist/server/daemon.js +6 -20
- package/package.json +1 -1
package/dist/server/daemon.js
CHANGED
|
@@ -275,10 +275,6 @@ export function startDaemon(opts) {
|
|
|
275
275
|
/** When GitHub was last asked whether a settled row has been re-requested, by
|
|
276
276
|
* artifact id. In-memory for the same reason: a restart just asks sooner. */
|
|
277
277
|
const requestCheckedAt = new Map();
|
|
278
|
-
/** What the last poll's searches returned. A row that has just dropped out
|
|
279
|
-
* of them most likely merged or closed, so its state check skips the queue.
|
|
280
|
-
* In-memory: a restart just waits for the rotation, as before. */
|
|
281
|
-
let lastSearched = new Set();
|
|
282
278
|
/**
|
|
283
279
|
* What GitHub has for you: the PRs awaiting your review, then your own open
|
|
284
280
|
* ones, as one deduplicated list — and whether the second search ran at all
|
|
@@ -569,14 +565,6 @@ export function startDaemon(opts) {
|
|
|
569
565
|
await file({ at: new Date().toISOString(), reason: "request-withdrawn", review: null, reply: null }, "nobody is asking for this review any more", filedByWithdrawnRequest);
|
|
570
566
|
}
|
|
571
567
|
const awaitingIds = new Set(refs.map((r) => artifactId(r)));
|
|
572
|
-
// A row that left the searches since last poll is checked now, outside the
|
|
573
|
-
// cap and the leash: it is the one most likely to have merged, and behind
|
|
574
|
-
// the rotation of every open draft it could sit in the inbox for several
|
|
575
|
-
// polls. Without the own-PR search, every PR of yours would look like it left.
|
|
576
|
-
const me = ownSearched ? null : await who();
|
|
577
|
-
const searchedBefore = lastSearched;
|
|
578
|
-
lastSearched = awaitingIds;
|
|
579
|
-
const leftSearch = (a) => searchedBefore.has(a.id) && (ownSearched || (me !== null && !isOwnPr(a.pr, me)));
|
|
580
568
|
let refreshed = 0;
|
|
581
569
|
for (const artifact of await listArtifacts()) {
|
|
582
570
|
if (artifact.status === "running")
|
|
@@ -614,14 +602,12 @@ export function startDaemon(opts) {
|
|
|
614
602
|
// Anything with real work in it: periodically confirm the PR is still
|
|
615
603
|
// open, so merged/closed ones stop cluttering the queue. Capped and
|
|
616
604
|
// spaced out — this is book-keeping, not a data feed.
|
|
617
|
-
if (
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
refreshed++;
|
|
624
|
-
}
|
|
605
|
+
if (refreshed >= STATE_REFRESH_CAP)
|
|
606
|
+
continue;
|
|
607
|
+
const last = stateCheckedAt.get(artifact.id) ?? 0;
|
|
608
|
+
if (Date.now() - last < STATE_REFRESH_MIN_MS)
|
|
609
|
+
continue;
|
|
610
|
+
refreshed++;
|
|
625
611
|
stateCheckedAt.set(artifact.id, Date.now());
|
|
626
612
|
try {
|
|
627
613
|
const pr = await fetchPrInfo(artifact.pr);
|
package/package.json
CHANGED