From 2d5be6c681eaed65b66975831565e6875fe874a3 Mon Sep 17 00:00:00 2001 From: Zach Leatherman Date: Fri, 7 Jan 2022 20:08:25 -0600 Subject: [PATCH] Fixed: benchmark was misreporting too many init calls --- src/Engines/Custom.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Engines/Custom.js b/src/Engines/Custom.js index 0383cda36..7b13ec12d 100644 --- a/src/Engines/Custom.js +++ b/src/Engines/Custom.js @@ -48,9 +48,9 @@ class CustomEngine extends TemplateEngine { // If we init from multiple places, wait for the first init to finish before continuing on. async _runningInit() { if (this.needsInit) { - let initBench = bench.get(`Engine (${this.name}) Init`); - initBench.before(); if (!this._initing) { + this._initBench = bench.get(`Engine (${this.name}) Init`); + this._initBench.before(); this._initing = this.entry.init.bind({ config: this.config, bench, @@ -58,7 +58,11 @@ class CustomEngine extends TemplateEngine { } await this._initing; this.needsInit = false; - initBench.after(); + + if (this._initBench) { + this._initBench.after(); + this._initBench = undefined; + } } }