Skip to content

fix/verified status request concurrency - #423

Open
zomop wants to merge 3 commits into
NotValra:mainfrom
zomop:fix/verified-status-concurrency
Open

zomop wants to merge 3 commits into
NotValra:mainfrom
zomop:fix/verified-status-concurrency

Conversation

@zomop

@zomop zomop commented Nov 9, 2026

Copy link
Copy Markdown

Summary

This PR improves authenticated user verification by replacing the shared global Promise with a per-user Promise cache using a Map.

Problem

Previously, a single global verifiedPromise was shared across verification requests.

When multiple users triggered verification concurrently, requests associated with different user IDs could unintentionally share the same Promise, potentially causing incorrect verification results.

Solution

  • Replace the global Promise with verifiedPromises, keyed by user ID.
  • Isolate concurrent verification requests between different users.
  • Deduplicate simultaneous requests for the same user.
  • Safely clean up completed Promises.
  • Prevent older Promises from deleting newer replacements.

Testing Results

  • Concurrent requests from different users: PASS
  • Concurrent requests for the same user: PASS
  • Account switching during pending requests: PASS
  • Refresh behavior: PASS
  • Promise cleanup and replacement safety: PASS
  • API failure and retry behavior: PASS

Regression tests: 6/6 PASS

Additional checks:

  • JavaScript syntax checks: PASS
  • ESLint on modified files: PASS
  • npm run build: PASS
  • npm run lint: FAIL due to 839 existing repository issues (358 errors and 481 warnings).

Notes

refresh = true bypasses persistent cache lookup but reuses an already-running request for the same user ID to avoid duplicate API requests.

No additional dependencies were introduced.

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.

2 participants