From 80a856f8dd44179e024c9b91cc6cb12988ff9973 Mon Sep 17 00:00:00 2001 From: Espen Hovlandsdal Date: Fri, 21 Dec 2018 02:30:49 +0100 Subject: [PATCH] fix(gatsby): fix eventemitter leak in page query runner (#10593) --- .../src/internal-plugins/query-runner/page-query-runner.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js index 04ab41dd3f0ed..09aeb7902bf46 100644 --- a/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js +++ b/packages/gatsby/src/internal-plugins/query-runner/page-query-runner.js @@ -162,9 +162,11 @@ const runQueriesForPathnames = pathnames => { } return new Promise(resolve => { - queue.on(`drain`, () => { + const onDrain = () => { + queue.off(`drain`, onDrain) resolve() - }) + } + queue.on(`drain`, onDrain) }) }