diff --git a/CHANGELOG.yaml b/CHANGELOG.yaml index 45441b07f..a3e911bbb 100644 --- a/CHANGELOG.yaml +++ b/CHANGELOG.yaml @@ -1,3 +1,9 @@ +unreleased: + fixed bugs: + - >- + GH-1373 Fixed a bug where execution.result and execution.skipRequest listeners + were not getting garbage collected + 7.36.2: date: 2024-01-19 chores: diff --git a/lib/runner/extensions/event.command.js b/lib/runner/extensions/event.command.js index 74b14e0a5..08dbb92f7 100644 --- a/lib/runner/extensions/event.command.js +++ b/lib/runner/extensions/event.command.js @@ -20,6 +20,7 @@ var _ = require('lodash'), EXECUTION_ERROR_EVENT_BASE = 'execution.error.', EXECUTION_COOKIES_EVENT_BASE = 'execution.cookies.', EXECUTION_SKIP_REQUEST_EVENT_BASE = 'execution.skipRequest.', + EXECUTION_RESULT_EVENT_BASE = 'execution.result.', COOKIES_EVENT_STORE_ACTION = 'store', COOKIE_STORE_PUT_METHOD = 'putCookie', @@ -179,7 +180,7 @@ module.exports = { if (cursor && cursor.execution && isExecutionSkipped(cursor.execution)) { return; } - handler.apply(context, arguments); + handler.apply(run, arguments); }); }; @@ -480,6 +481,8 @@ module.exports = { this.host.removeAllListeners(EXECUTION_RESPONSE_EVENT_BASE + executionId); this.host.removeAllListeners(EXECUTION_COOKIES_EVENT_BASE + executionId); this.host.removeAllListeners(EXECUTION_ERROR_EVENT_BASE + executionId); + this.host.removeAllListeners(EXECUTION_SKIP_REQUEST_EVENT_BASE + executionId); + this.host.removeAllListeners(EXECUTION_RESULT_EVENT_BASE + executionId); // Handle async errors as well. // If there was an error running the script itself, that takes precedence