Skip to content

Commit

Permalink
Catch avet server prepare error (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
okoala authored Dec 3, 2017
1 parent f45fa15 commit f138919
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions packages/avet-cluster/lib/app_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ process.send({ to: 'master', action: 'realport', data: port });

const avetServer = new AvetServer(avetOptions);

avetServer.prepare().then(() => {
app.use(function*(next) {
yield avetServer.run(this, next);
avetServer
.prepare()
.then(() => {
app.use(function*(next) {
yield avetServer.run(this, next);

if (!this.res.finished) {
yield next;
}
});

if (!this.res.finished) {
yield next;
}
app.ready(startServer);
})
.catch(err => {
console.error(err);
});

app.ready(startServer);
});

// exit if worker start timeout
app.once('startTimeout', startTimeoutHandler);
function startTimeoutHandler() {
Expand Down

0 comments on commit f138919

Please sign in to comment.