Skip to content

Commit

Permalink
Fix memory leak introduced in skip request related changes.
Browse files Browse the repository at this point in the history
- execution.result and execution.skipRequest listeners
          were not getting garbage collected
  • Loading branch information
vedkribhu committed Jan 31, 2024
1 parent 1aba274 commit d54d2ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
5 changes: 4 additions & 1 deletion lib/runner/extensions/event.command.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -179,7 +180,7 @@ module.exports = {

if (cursor && cursor.execution && isExecutionSkipped(cursor.execution)) { return; }

handler.apply(context, arguments);
handler.apply(run, arguments);
});
};

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d54d2ce

Please sign in to comment.