Skip to content

Commit ba398da

Browse files
author
anandkumarpatel
committed
Merge pull request #475 from CodeNow/client-with-retries
moved retry logic to client
2 parents bd03fc5 + 2a1e4b9 commit ba398da

File tree

2 files changed

+2
-28
lines changed

2 files changed

+2
-28
lines changed

lib/models/apis/runnable.js

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,7 @@ Runnable.prototype.redeployInstance = function (instance, opts, cb) {
7070
opts = {};
7171
}
7272
var instanceModel = this.newInstance(instance.shortHash);
73-
var retries = 0;
74-
var maxRetries = 15;
75-
redeploy();
76-
function redeploy () {
77-
instanceModel.redeploy(opts, function (err) {
78-
if (err) {
79-
if (err.output.statusCode === 409 && opts.json.build) {
80-
// only attempt retries if buildId is provided
81-
setTimeout(function () {
82-
attemptRetry(err);
83-
}, 500);
84-
return;
85-
}
86-
cb(err); // real error
87-
}
88-
else {
89-
cb.apply(this, arguments);
90-
}
91-
});
92-
}
93-
function attemptRetry (err) {
94-
if (retries > maxRetries) {
95-
return cb(err);
96-
}
97-
retries++;
98-
return redeploy();
99-
}
73+
instanceModel.redeploy(opts, cb);
10074
};
10175

10276

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"request": "2.42.0",
7070
"rimraf": "^2.2.8",
7171
"rollbar": "^0.3.13",
72-
"runnable": "git+ssh://[email protected]:CodeNow/runnable-api-client#v0.38.4",
72+
"runnable": "git+ssh://[email protected]:CodeNow/runnable-api-client#v0.38.12",
7373
"s3-stream-upload": "0.0.6",
7474
"simple-api-client": "^0.5.9",
7575
"substream": "0.1.1",

0 commit comments

Comments
 (0)