Repository navigation
fix(api,web): debounce account search and cache service token (REGBACKLOG-445) - #1950
jimmypalelil wants to merge 1 commit into
Conversation
|
Temporary Url for review: https://strr-hosts-dev--pr-1950-xxpr4z2k.web.app |
ed52d9b to
7944470
Compare
|
Temporary Url for review: https://strr-hosts-dev--pr-1950-xxpr4z2k.web.app |
Is there a ticket for this? Otherwise those tests stay broken without anyone noticing. |
| "private": true, | ||
| "type": "module", | ||
| "version": "1.3.38", | ||
| "version": "1.3.39", |
There was a problem hiding this comment.
Feel free to resolve this conversation if you're not concerned about this.
| """Ensure service client token cache is isolated per test.""" | ||
| AuthService._token_cache.clear() | ||
| yield | ||
| AuthService._token_cache.clear() |
There was a problem hiding this comment.
Clever way to clear before and after each test 👍
There was a problem hiding this comment.
Feel free to resolve this conversation, haha.
7944470 to
888b855
Compare
|
Temporary Url for review: https://strr-hosts-dev--pr-1950-xxpr4z2k.web.app |
888b855 to
612a3b5
Compare
|
Temporary Url for review: https://strr-hosts-dev--pr-1950-xxpr4z2k.web.app |
severinbeauvais
left a comment
There was a problem hiding this comment.
I'm happy with this when you're happy with this.
612a3b5 to
6eea962
Compare
|
|
Temporary Url for review: https://strr-hosts-dev--pr-1950-xxpr4z2k.web.app |



Issue:
Description of changes:
1.3.39):150msto450msinapp/pages/auth/account/create-new.vue.trimmedName.length < 3) before queryingGET /accounts/search, resettingaccountExists/ loading state and revalidating silently when shorter./accounts/searchrequests usingAbortControlleron subsequent keystrokes, before new requests, and on scope dispose, ignoringAbortErrorresponses.tests/unit/create-new-account-page.spec.tscovering minimum length, debounce timing, and in-flight request cancellation.tests/e2e/create-new-account.test.tscovering minimum length, debounced typing, existing/unique account validation, and dropping below 3 characters (kept separate fromtests/e2e/smoke-tests/Scenario-*.test.tssince existing smoke specs fail at import time on a removedi18nText.rentalUnitSetupTypekey), and fix the BCSC TOS locator visibility check intests/e2e/test-utils/auth-setup.ts.0.3.47):AuthService._token_cache(cachelib.SimpleCache) keyed by client credentials/token URL with a safety buffer (ttl - min(30, ttl // 5)) and skip caching whenexpires_in <= 0.print(token)debug statement inAuthService.search_accounts.cachelib = "^0.13.0"directly inpyproject.tomland updatepoetry.lock.tests/unit/services/test_auth_service.pycovering token caching within TTL, near-expiry refresh, and zero-TTL handling.How this was tested:
strr-host-pm-webunit tests:pnpm vitest run --dir tests/unit— 24 test files, 346 tests passed;pnpm lint— passed.strr-host-pm-webE2E test:npx playwright test tests/e2e/create-new-account.test.tsagainst localnuxt dev(http://localhost:3000) + localstrr-api(http://127.0.0.1:8000) — 1 passed (11.6s);npx eslint— passed.strr-apiunit tests & linters:pytest tests/unit/services/test_auth_service.py --no-cov— 16 passed;black --check,isort --check,pylint src/strr_api/services/auth_service.py(10.00/10), andpoetry check— passed.strr-api(gunicornon127.0.0.1:8000, connected to dev Keycloak & Auth API) and benchmarkedAuthService.get_service_client_token()andGET /accounts/search?name=Strr(10 requests, all200 OK):get_service_client_token): cold93.95ms→ warm cached0.0022ms(median)GET /accounts/search: cold (1st request)763.81ms→ warm (requests 2–10)p50 = 339.67ms(min332.67ms, max351.95ms) — 55.5% latency reduction (~424mssaved per request).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the BC Registry and Digital Services BSD 3-Clause License