Skip to content

fix: record lambda timeouts, fix ad-block fetching, pool DB connections - #184

Merged
mschfh merged 5 commits into
mainfrom
mschfh-timeouts
Jul 29, 2026
Merged

fix: record lambda timeouts, fix ad-block fetching, pool DB connections#184
mschfh merged 5 commits into
mainfrom
mschfh-timeouts

Conversation

@mschfh

@mschfh mschfh commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.Pool with client.release(err) semantics and retrying pool.connect().
  • Fix/optimize adblock rules loading by caching rules.dat bytes (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.

Comment thread index.js
Comment thread brave/lambda_actions/crawl-dispatch.js Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mschfh
mschfh marked this pull request as ready for review July 28, 2026 07:47
@mschfh
mschfh merged commit a732393 into main Jul 29, 2026
4 checks passed
@mschfh
mschfh deleted the mschfh-timeouts branch July 29, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants