Skip to content

Commit

Permalink
bug: fix blocking perf bug
Browse files Browse the repository at this point in the history
  • Loading branch information
nickreese committed Mar 8, 2022
1 parent aa922f6 commit 4a77268
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@elderjs/elderjs",
"version": "1.6.11",
"version": "1.6.12",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"engineStrict": true,
Expand Down
4 changes: 2 additions & 2 deletions src/Elder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,6 @@ class Elder {
this.router = prepareRouter(this);
this.perf.end(`startup.prepareRouter`);

this.markBootstrapComplete(this);

this.perf.end('startup');
this.perf.stop();

Expand All @@ -363,6 +361,8 @@ class Elder {
displayPerfTimings([...this.perf.timings]);
}
}

this.markBootstrapComplete(this);
});
});
}
Expand Down
25 changes: 14 additions & 11 deletions src/utils/prepareServer.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
function prepareServer({ bootstrapComplete }) {
// eslint-disable-next-line consistent-return
return async function prepServer(req, res, next) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { runHook, perf, ...bootstrap } = await bootstrapComplete;

await runHook('middleware', {
...bootstrap,
runHook,
req,
next,
res,
request: { type: 'server' },
});
try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { runHook, ...bootstrap } = await bootstrapComplete;
await runHook('middleware', {
...bootstrap,
runHook,
req,
next,
res,
request: { type: 'server' },
});
} catch (e) {
console.error(e);
}
};
}

Expand Down

0 comments on commit 4a77268

Please sign in to comment.