Skip to content

Commit

Permalink
fix: performance npe when restart error (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Dec 25, 2024
1 parent c2b6b0f commit 4cf9ab0
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,24 +306,23 @@ function run() {
performance.mark('app-end');
performance.measure('App Restart', 'app-start', 'app-end');

const measures = performance.getEntriesByType('measure');
const killMeasureName = hasPaths ? 'Kill & Alias Replace' : 'Process Kill';
const killMeasure = measures.find(m => m.name === killMeasureName);
const appMeasure = measures.find(m => m.name === 'App Restart');

restartPerfStats = [
{
name: killMeasureName,
duration: killMeasure.duration
},
{
name: 'App Restart',
duration: appMeasure.duration
}
];

consoleOutput.renderServerReady(during, debugUrl);
if (isPerfInit) {
const measures = performance.getEntriesByType('measure');
const killMeasureName = hasPaths ? 'Kill & Alias Replace' : 'Process Kill';
const killMeasure = measures.find(m => m.name === killMeasureName);
const appMeasure = measures.find(m => m.name === 'App Restart');

restartPerfStats = [
{
name: killMeasureName,
duration: killMeasure ? killMeasure.duration : 0
},
{
name: 'App Restart',
duration: appMeasure ? appMeasure.duration : 0
}
];
consoleOutput.renderPerfStats(restartPerfStats);
}

Expand Down

0 comments on commit 4cf9ab0

Please sign in to comment.