Skip to content

Commit

Permalink
Merge branch 'return-callback-immediately' into politics-rewired/deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
bchrobot committed Feb 1, 2019
2 parents 011e407 + 98af074 commit 2e2a2e0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ function cleanHeaders(event) {
}

exports.handler = (event, context, handleCallback) => {
// Database connection pool means the event loop will never be empty so don't wait for it to be
// See: https://github.com/tgriesser/knex/issues/1875#issuecomment-321033705
context.callbackWaitsForEmptyEventLoop = false

// Note: When lambda is called with invoke() we MUST call handleCallback with a success
// or Lambda will re-run/re-try the invocation twice:
// https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html
Expand Down

2 comments on commit 2e2a2e0

@ben-pr-p
Copy link
Contributor

@ben-pr-p ben-pr-p commented on 2e2a2e0 Feb 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any situations where this would mess up JOBS_SAME_PROCESS stuff? (situations where we rely on server staying up beyond the request)

@bchrobot
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once outstanding PRs are merged I will revert this change

Please sign in to comment.