Skip to content

Commit

Permalink
fix cli 4 (#4292)
Browse files Browse the repository at this point in the history
Co-authored-by: Henry Fontanier <[email protected]>
  • Loading branch information
fontanierh and Henry Fontanier authored Mar 13, 2024
1 parent b79ee21 commit 9570651
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions connectors/src/admin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1090,32 +1090,21 @@ const temporal = async (command: string, args: parseArgs.ParsedArgs) => {

case "find-unprocessed-workflows": {
const c = await getTemporalClient();
let npt: Uint8Array | null = null;
const queues = new Set<string>();
let openWfRes: Awaited<
ReturnType<typeof c.workflowService.listOpenWorkflowExecutions>
> | null = null;
let i = 0;
do {
console.log(`Fetching page ${++i}`);
openWfRes = await c.workflowService.listWorkflowExecutions({
namespace: process.env.TEMPORAL_NAMESPACE || "default",
pageSize: 500,
nextPageToken: npt,
query: `ExecutionStatus="Running"`,
});
npt = openWfRes.nextPageToken;
if (openWfRes.executions?.length) {
console.log(`got ${openWfRes.executions.length} results`);
for (const x of openWfRes.executions) {
if (x.taskQueue) {
queues.add(x.taskQueue);
}

const openWfRes = await c.workflowService.listWorkflowExecutions({
namespace: process.env.TEMPORAL_NAMESPACE || "default",
pageSize: 5000,
query: `ExecutionStatus="Running"`,
});
if (openWfRes.executions?.length) {
console.log(`got ${openWfRes.executions.length} results`);
for (const x of openWfRes.executions) {
if (x.taskQueue) {
queues.add(x.taskQueue);
}
} else {
break;
}
} while (npt);
}

for (const q of queues) {
console.log("looking at queue", q);
Expand Down

0 comments on commit 9570651

Please sign in to comment.