fix: record lambda timeouts, fix ad-block fetching, pool DB connections - #184
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves Lambda invocation robustness and performance by (1) pooling Postgres connections, (2) making adblock rule loading more efficient/correct, and (3) adding minor operational hardening around observability and S3 integrity behavior.
Changes:
- Switch DB access to a shared
pg.Poolwithclient.release(err)semantics and retryingpool.connect(). - Fix/optimize adblock rules loading by caching
rules.datbytes (LRU) and deserializing from a byte array per message. - Make S3 client checksum behavior explicit and attempt to increase Sentry breadcrumb capacity when the Sentry Lambda layer is present.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
index.js |
Adjusts Sentry client options at startup (guarded for layer-only installs). |
brave/s3.js |
Makes S3 checksum calculation/validation explicit and does minor formatting cleanup. |
brave/lambda_actions/record.js |
Adds LRU caching for rules.dat bytes and updates DB client release behavior. |
brave/lambda_actions/crawl-dispatch.js |
Wraps DB writes/fetch loop with error-aware DB release and pool-friendly handling. |
brave/lambda_actions/build.js |
Ensures DB clients are released back to the pool via finally. |
brave/db.js |
Introduces pooled DB connections with shared config, retries, and release(err) cleanup semantics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
mschfh
marked this pull request as ready for review
July 28, 2026 07:47
StephenHeaps
approved these changes
Jul 28, 2026
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.
No description provided.