perf(portal): reduce auth log noise and enable HTTP connection reuse (#83)#164
Open
b3lz3but wants to merge 3 commits intocaptainpragmatic:masterfrom
Open
perf(portal): reduce auth log noise and enable HTTP connection reuse (#83)#164b3lz3but wants to merge 3 commits intocaptainpragmatic:masterfrom
b3lz3but wants to merge 3 commits intocaptainpragmatic:masterfrom
Conversation
…aptainpragmatic#83) - Downgrade require_customer_authentication decorator logs from INFO to DEBUG (fires on every request, ~4-5 lines per authenticated call) - Switch portal_request() from one-shot requests.request() to a module-level requests.Session() for HTTP keep-alive connection pooling - Update outbound_http tests to patch _session.request Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
Contributor
Author
ChangesAuth logging (Platform
Connection reuse (Portal
Test updates (
@mostlyvirtual requesting your review. |
Update all portal test files to patch _session.request instead of requests.request, matching the connection pooling change in outbound_http.py. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
…aptainpragmatic#83) Dashboard view already fetches invoice, services, and tickets summaries. Seed the account_health session cache with this data so the context processor (which runs on every page) skips 3 redundant API calls on the first request after login. Combined with the prior commit (auth logging + connection reuse), this fully addresses captainpragmatic#83: 16 API calls per login+dashboard reduced to ~10, ~80% log noise reduction, and TCP connection reuse via keep-alive. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Ciprian Radulescu <craps2003@gmail.com>
Contributor
Author
What changed (3 commits)Commit 1 — Auth logging + connection reuse (Opt 3 + Opt 4):
Commit 2 — HMAC test patches:
Commit 3 — Dashboard session cache seeding (Opt 2):
Opt 1 (session seeding during login):
Net result: 16 API calls per login+dashboard → ~10, ~80% log noise reduction, TCP connection reuse. @mostlyvirtual requesting your review. |
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.
Summary
Fully addresses #83 — Portal→Platform API call optimization (16→10 calls per login).
Opt 3 — Auth logging reduction:
require_customer_authenticationdecorator logs fromINFOtoDEBUG— fires on every authenticated request, ~80% log noise reductionOpt 4 — HTTP connection reuse:
portal_request()from one-shotrequests.request()to module-levelrequests.Session()for HTTP keep-alive connection poolingOpt 2 — Dashboard session cache seeding:
account_health_datasession cache so the context processor skips 3 redundant API callsOpt 1 — Session seeding during login:
user_membershipsand setsactive_customer_idso middleware skipsget_user_customers()call. Profile is fetched for greeting name.Closes #83
Performance impact
Test plan
Generated with Claude Code