MCPcopy
hub / github.com/coder/mux / listPending

Method listPending

src/node/services/bashMonitorWakeStore.ts:212–231  ·  view source on GitHub ↗
(ownerWorkspaceId: string)

Source from the content-addressed store, hash-verified

210 }
211
212 async listPending(ownerWorkspaceId: string): Promise<BashMonitorWakeRecord[]> {
213 const dir = this.dir(ownerWorkspaceId);
214 let entries: string[];
215 try {
216 entries = await fsPromises.readdir(dir);
217 } catch (error) {
218 if (isErrnoWithCode(error, "ENOENT")) return [];
219 throw error;
220 }
221 const records: BashMonitorWakeRecord[] = [];
222 for (const entry of entries) {
223 if (!entry.endsWith(".json")) continue;
224 const raw = await fsPromises.readFile(path.join(dir, entry), "utf-8").catch(() => null);
225 if (raw == null) continue;
226 const parsed = this.parse(raw);
227 if (parsed?.status === "pending") records.push(parsed);
228 }
229 records.sort((a, b) => a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
230 return records;
231 }
232
233 async listPendingOwnerWorkspaceIds(): Promise<string[]> {
234 let entries: Dirent[];

Calls 5

dirMethod · 0.95
parseMethod · 0.95
isErrnoWithCodeFunction · 0.90
readFileMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected