Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core) - PDE-5490 calling lambda callback doesnt wait for event loop #904

Merged
merged 6 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/core/src/tools/create-lambda-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ const createLambdaHandler = (appRawOrPath) => {
// Wait for all async events to complete before callback returns.
// This is not strictly necessary since this is the default now when
// using the callback; just putting it here to be explicit.
// In some cases, the code hangs and never exits because the event loop is not
// empty, so we can override the default behavior and exit after the app is done.
context.callbackWaitsForEmptyEventLoop = true;
if (event.skipWaitForAsync === true) {
context.callbackWaitsForEmptyEventLoop = false;
}

// replace native Promise with bluebird (works better with domains)
if (!event.calledFromCli) {
Expand Down Expand Up @@ -264,6 +269,7 @@ const createLambdaHandler = (appRawOrPath) => {
const compiledApp = schemaTools.prepareApp(appRaw);

const input = createInput(compiledApp, event, logger, logBuffer, rpc);

return app(input);
})
.then((output) => {
Expand Down
Loading