Skip to content

Commit

Permalink
Merge pull request #380 from jgilbert01/issue-mw-memory-leak
Browse files Browse the repository at this point in the history
Fix memory leak in middleware layer
  • Loading branch information
petermyers authored Sep 5, 2024
2 parents 104073c + acc47a2 commit 72375a7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-lambda-stream",
"version": "1.0.22",
"version": "1.0.23",
"description": "Create stream processors with AWS Lambda functions.",
"keywords": [
"aws",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const mw = (handle, opt) => {
const stack = [];

const run = (event, context) => {
stack.push((n, o, e, c) => handle(e, c, o)); // do the real work last
const runner = (index) => Promise.resolve(stack[index](() => runner(index + 1), opt, event, context));
const mwStack = [...stack, (n, o, e, c) => handle(e, c, o)]; // Do the real work last
const runner = (index) => Promise.resolve(mwStack[index](() => runner(index + 1), opt, event, context));
return Promise.resolve(runner(0));
};

Expand Down

0 comments on commit 72375a7

Please sign in to comment.