Skip to content

Commit

Permalink
v4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
schnerd committed Aug 16, 2023
1 parent 37de535 commit 31ddda8
Show file tree
Hide file tree
Showing 11 changed files with 563 additions and 86 deletions.
2 changes: 1 addition & 1 deletion api.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Methods:
- <code title="get /files/{file_id}">client.files.<a href="./src/resources/files.ts">retrieve</a>(fileId) -> FileObject</code>
- <code title="get /files">client.files.<a href="./src/resources/files.ts">list</a>() -> FileObjectsPage</code>
- <code title="delete /files/{file_id}">client.files.<a href="./src/resources/files.ts">del</a>(fileId) -> FileDeleted</code>
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">retrieveFileContent</a>(fileId) -> string</code>
- <code title="get /files/{file_id}/content">client.files.<a href="./src/resources/files.ts">retrieveContent</a>(fileId) -> string</code>

# Images

Expand Down
21 changes: 20 additions & 1 deletion ecosystem-tests/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ function parseArgs() {
default: 1,
description: 'number of parallel jobs to run',
},
retry: {
type: 'number',
default: 0,
description: 'number of times to retry failing jobs',
},
parallel: {
type: 'boolean',
default: false,
Expand Down Expand Up @@ -202,6 +207,7 @@ async function main() {
while (queue.length) {
const project = queue.shift();
if (!project) break;

let stdout, stderr;
try {
runningProjects.add(project);
Expand All @@ -212,6 +218,7 @@ async function main() {
__filename,
project,
'--skip-pack',
`--retry=${args.retry}`,
...(args.live ? ['--live'] : []),
...(args.verbose ? ['--verbose'] : []),
...(args.deploy ? ['--deploy'] : []),
Expand Down Expand Up @@ -245,7 +252,7 @@ async function main() {
console.error('\n');

try {
await fn();
await withRetry(fn, project, state.retry)
console.error(`✅ - Successfully ran ${project}`);
} catch (err) {
if (err && (err as any).shortMessage) {
Expand All @@ -268,6 +275,18 @@ async function main() {
process.exit(0);
}

async function withRetry(fn: () => Promise<void>, identifier: string, retryAmount: number): Promise<void> {
do {
try {
return await fn()
} catch (err) {
console.error(`${identifier} failed due to ${err}; retries left ${retryAmount}`)
}

retryAmount--;
} while (retryAmount > 0)
}

function centerPad(text: string, width = text.length, char = ' '): string {
return text.padStart(Math.floor((width + text.length) / 2), char).padEnd(width, char);
}
Expand Down
Loading

0 comments on commit 31ddda8

Please sign in to comment.