Merged
Conversation
camposeddie
reviewed
Sep 5, 2025
camposeddie
approved these changes
Sep 9, 2025
Contributor
camposeddie
left a comment
There was a problem hiding this comment.
I think everything looks good as a first pass on getting functionality built into the lambda. For the future, it may be better to separate the query timeout from lambda timeout to allow more granular control over each. For our current use case, this works fine 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Queries executed by the lambda now have a timeout less than the lambda's max run time, configured by the connection's
statement_timeout. Currently, the lambda has at 1 second grace period to cover other operations such as closing the Postgres connection in the event of a query timeout. It may be worth making this grace period either configurable via Terraform or proportional to the lambda's max run time. This flat grace period might not be adequate for S3 writes in cases where a hypothetical long running query returns just shy of thestatement_timeout. Let me know if you think either of these additions are appropriate.Psycopg connections were also not being closed and that has been fixed. Psycopg2 connections use contexts as separate transactions instead of closing at the end of them, so until now the lambda was not gracefully closing its connections.