Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shayan/FEQ-2696/Fix redundant Cloudflare trace API calls #91

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

shayan-deriv
Copy link
Collaborator

Problem

Multiple simultaneous requests to cloudflare.com/cdn-cgi/trace during app initialization causing console errors and unnecessary network calls.

Solution

Implemented Promise caching in getCountry utility to deduplicate requests:

  • Caches ongoing Promise to prevent parallel calls
  • Clears cache after completion
  • Maintains existing cookie fallback

Copy link

github-actions bot commented Nov 15, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

@coveralls
Copy link
Collaborator

coveralls commented Nov 15, 2024

Pull Request Test Coverage Report for Build 11854718569

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.827%

Totals Coverage Status
Change from base Build 11701449441: 0.0%
Covered Lines: 577
Relevant Lines: 577

💛 - Coveralls

Copy link
Contributor

@amam-deriv amam-deriv left a comment

Choose a reason for hiding this comment

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

Unique approach, but left few comments

src/utils/country.utils.ts Outdated Show resolved Hide resolved
src/utils/country.utils.ts Outdated Show resolved Hide resolved
Copy link

cloudflare-workers-and-pages bot commented Nov 15, 2024

Deploying deriv-utils with  Cloudflare Pages  Cloudflare Pages

Latest commit: db6a89f
Status: ✅  Deploy successful!
Preview URL: https://6d3f5bf5.deriv-utils.pages.dev
Branch Preview URL: https://shayan-feq-2696-fix-network.deriv-utils.pages.dev

View logs

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.

4 participants