Skip to content

Commit b248309

Browse files
committed
retry if orca hangs
1 parent 4a44a98 commit b248309

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
at: ~/plotly.js
122122
- run:
123123
name: Run image tests
124-
command: ./.circleci/orca_generate.sh
124+
command: ./.circleci/retry-orca-build-verify.js
125125
no_output_timeout: 2m
126126
- store_artifacts:
127127
path: build
File renamed without changes.

.circleci/retry-orca-build-verify.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env node
2+
const timeout = 60; // in seconds
3+
var spawn = require('child_process').spawn;
4+
5+
function retry(cmd, args, trials) {
6+
if(trials === 0) {process.exit(1)}
7+
8+
console.log(trials + ' trials left');
9+
10+
function retryAfterTimeout() {
11+
console.log('Retrying after no output for ' + timeout + ' seconds');
12+
child.kill();
13+
retry(cmd,args, --trials)
14+
}
15+
16+
const child = spawn(cmd,args);
17+
18+
setTimeout(retryAfterTimeout, timeout * 1000)
19+
child.stdout.on('data', function(data) {
20+
clearTimeout(retryAfterTimeout);
21+
console.log(data.toString());
22+
})
23+
24+
child.on('error', function(err) {
25+
console.log(err.toString());
26+
retry(cmd, args, --trials)
27+
})
28+
29+
child.on('close', function(code) {
30+
console.log('Excit with code ' + code);
31+
process.exit(code)
32+
})
33+
}
34+
35+
retry('.circleci/orca_generate.sh',[], 5)

0 commit comments

Comments
 (0)