mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-07 17:04:42 +00:00
fix(server): batch cold-start PR status polls (#4025)
The initial retained poll could run before repository identity discovery settled, routing every workspace through the legacy per-target path. Defer each unresolved target independently and rejoin the shared polling grid once its identity is ready.
This commit is contained in:
@@ -1471,13 +1471,29 @@ export function createGitHubService(options: CreateGitHubServiceOptions = {}): G
|
||||
const legacyTargets: GitHubPollTarget[] = [];
|
||||
const batchGroups = new Map<string, GitHubBatchPollEntry[]>();
|
||||
for (const target of due) {
|
||||
if (target.retainCount <= 0) {
|
||||
continue;
|
||||
}
|
||||
const host = peekRepoHost(target.cwd);
|
||||
const slug = peekRepoSlug(target.cwd);
|
||||
if (!host.settled || !slug.settled) {
|
||||
target.pollCycleStartedAt = null;
|
||||
void Promise.all([
|
||||
resolveRepoHostCached(target.cwd).catch(() => null),
|
||||
resolveRepoSlugCached(target.cwd),
|
||||
]).then(() => {
|
||||
if (target.retainCount > 0 && target.nextDueAt === null) {
|
||||
// A non-zero delay rejoins the shared polling grid.
|
||||
scheduleGitHubPollAfter(target, 1);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
continue;
|
||||
}
|
||||
const [owner, name, extra] = slug.value?.split("/") ?? [];
|
||||
// A cwd whose host or slug is still resolving (or has no origin slug at
|
||||
// all) polls through the legacy per-target path this cycle; batch
|
||||
// grouping needs both facts synchronously.
|
||||
if (!host.settled || !slug.settled || !owner || !name || extra !== undefined) {
|
||||
// A cwd with no origin slug polls through the legacy per-target path;
|
||||
// batch grouping needs a complete owner/name identity.
|
||||
if (!owner || !name || extra !== undefined) {
|
||||
legacyTargets.push(target);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user