Repository navigation
perf(backend): batch digest and push writes, read in parallel, share parsers, delete dead code - #2444
Conversation
…fix verifications with the org - DigestService: the daily membership sweep wrote one upsert per member. It now writes multi-row upserts of 500, deduped by (org, user) with the last entry winning as before, because Postgres rejects an upsert that touches a row twice in one statement. Clerk member lists are read four orgs at a time instead of one. - MobileDevicesService.markPushed: one UPDATE for the whole id list instead of one per device. - OnCallSchedulesService.list, AnomalyAlertSource.observe and loadStepRecipients: independent reads outside a transaction now run together on the invocation's pool instead of one after another. - OrganizationService: error_issue_verifications is purged on org deletion, like the issue tables it points at. A leftover waiting row was selected by the verification tick on every run and skipped, taking a slot of the per-tick limit for good.
… dead code - getBearerToken had four identical copies, one per auth layer. It lives in services/auth/bearer-token.ts now. - parseEncryptionKey had three copies differing only in the error they build. platform/Crypto.ts exports parseIngestKeyEncryptionKey, which takes the error constructor. - Deleted services/alerts/alert-templates (and its test): no production importer in any workspace, the dashboard and the MCP tool keep their own. - Deleted the unreferenced GithubApiPullRequestFile and GithubReviewThread types, and captureReusableContext, which only its test called. That test now exercises withoutInvocationContext, the function production uses. - Two comments said every execute dials its own Postgres client. The invocation's pool is reused, so they now say what batching saves.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 1 minute. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
On the review's manual step (orgs deleted before this deploy keep their |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Maple review🟢 Confidence 10/10 · safe to merge. Batched writes and the org purge are pinned by new PGlite tests; the three concurrency edits only reorder independent reads. (The kickoff's "changed since then" list named files this diff does not con… Batches the daily membership sweep and the device push stamp into multi-row writes, runs three groups of independent reads concurrently, and purges fix-verification rows with the org. The new writes and the purge are exercised by tests; no correctness, scoping or data-loss defect found.
|
Maple: after this shippedDeployed to New errors since the deploy:
Maple looks once, an hour after the first deploy that carries the merge. |
Stacked on #2443. Part of the audit stack that starts at #2434.
Efficiency
Behaviour change
waitingrow left behind was selected and skipped by the verification tick on every run.Cleanup
getBearerTokenhad four identical copies in the auth layers andparseEncryptionKeythree near-copies. Each lives in one module now.alert-templates/directory (imported only by its own test), two unused GitHub client types andcaptureReusableContext. Its test now coverswithoutInvocationContext, which had no other coverage.Verification
packages/backend(238 tests) and the mobile devices route test inapps/apipass.packages/backendtypecheck is clean. Lint and format are clean on the changed files.Left for a decision
ErrorIssuePullRequestsand the other issue child tables are still not purged with an org.docs/product-events-dashboard-parity.mdstill namesalert-templates/as the place for a new template.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.