@omercnet/paseo-pr-radar 3.0.0-next.284.1 → 3.0.0-next.293.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 +5 -5
- package/server/viewer-scope.ts +25 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omercnet/paseo-pr-radar",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.293.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A viewer-aware delivery queue for pull requests linked to Paseo workspaces.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,10 +47,10 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@biomejs/biome": "^2.5.10",
|
|
50
|
-
"@getpaseo/cli": "0.13.0
|
|
51
|
-
"@getpaseo/client": "0.13.0
|
|
52
|
-
"@getpaseo/plugin": "0.13.0
|
|
53
|
-
"@getpaseo/protocol": "0.13.0
|
|
50
|
+
"@getpaseo/cli": "0.13.0",
|
|
51
|
+
"@getpaseo/client": "0.13.0",
|
|
52
|
+
"@getpaseo/plugin": "0.13.0",
|
|
53
|
+
"@getpaseo/protocol": "0.13.0",
|
|
54
54
|
"@tanstack/react-query": "^5.102.3",
|
|
55
55
|
"@types/node": "^24.10.1",
|
|
56
56
|
"@types/react": "^19.2.18",
|
package/server/viewer-scope.ts
CHANGED
|
@@ -70,6 +70,29 @@ async function runGh(args: string[], timeout = COMMAND_TIMEOUT_MS): Promise<stri
|
|
|
70
70
|
return stdout.trim();
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
+
/**
|
|
74
|
+
* One refresh issues four searches (the scope searches page up to ten times each). GitHub advises
|
|
75
|
+
* serial requests to avoid secondary rate limits, so searches share a small queue.
|
|
76
|
+
*/
|
|
77
|
+
const SEARCH_CONCURRENCY = 2;
|
|
78
|
+
let activeSearches = 0;
|
|
79
|
+
const searchWaiters: Array<() => void> = [];
|
|
80
|
+
|
|
81
|
+
async function runSearch(args: string[]): Promise<string> {
|
|
82
|
+
while (activeSearches >= SEARCH_CONCURRENCY) {
|
|
83
|
+
const { promise, resolve } = Promise.withResolvers<void>();
|
|
84
|
+
searchWaiters.push(resolve);
|
|
85
|
+
await promise;
|
|
86
|
+
}
|
|
87
|
+
activeSearches += 1;
|
|
88
|
+
try {
|
|
89
|
+
return await runGh(args);
|
|
90
|
+
} finally {
|
|
91
|
+
activeSearches -= 1;
|
|
92
|
+
searchWaiters.shift()?.();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
73
96
|
function delay(milliseconds: number): Promise<void> {
|
|
74
97
|
const { promise, resolve } = Promise.withResolvers<void>();
|
|
75
98
|
setTimeout(resolve, milliseconds);
|
|
@@ -110,7 +133,7 @@ async function searchPullRequests(
|
|
|
110
133
|
"commentsCount",
|
|
111
134
|
"labels",
|
|
112
135
|
].join(",");
|
|
113
|
-
const output = await
|
|
136
|
+
const output = await runSearch([
|
|
114
137
|
"search",
|
|
115
138
|
"prs",
|
|
116
139
|
`--${filter}=${viewer}`,
|
|
@@ -126,7 +149,7 @@ async function searchPullRequests(
|
|
|
126
149
|
}
|
|
127
150
|
|
|
128
151
|
async function searchScopeUrls(filter: "author" | "review-requested"): Promise<string[]> {
|
|
129
|
-
const output = await
|
|
152
|
+
const output = await runSearch([
|
|
130
153
|
"search",
|
|
131
154
|
"prs",
|
|
132
155
|
`--${filter}=@me`,
|