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

Fix/claims-search #135

Merged
merged 3 commits into from
Aug 31, 2024
Merged

Fix/claims-search #135

merged 3 commits into from
Aug 31, 2024

Conversation

omareloui
Copy link
Contributor

Description

This PR fixes /api/claimsfeed2 pagination and performance issues (went from 9+ seconds to ~1.2s).

Type of Change

  • Bug fix
  • New feature
  • Test case
  • Documentation update
  • Other (please describe)

Checklist

  • I have added tests that prove my fix is effective or that my feature works (optional)
  • I have added necessary documentation (if applicable)

4- steps to test?

After running the server hit the /api/claimsfeed2 endpoint with deferent query strings values.

5- results?

  • There will not be any duplicate claims.
  • Reduced response time.
  • Pagination works.

7- screenshots?

N/A

const { page = 1, limit = 100, search = "" } = req.query; // defaults provided here
let { page = 1, limit = 100, search = "" } = req.query;

page = parseInt(page.toString());
Copy link
Member

Choose a reason for hiding this comment

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

we can use page = +page here and the other fields instead of using all these methods as it costs somehow

Copy link
Contributor Author

@omareloui omareloui Aug 29, 2024

Choose a reason for hiding this comment

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

The cost difference is nothing. I made it this way to avoid floating numbers as +page will include decimals

@omareloui omareloui self-assigned this Aug 29, 2024
@AhmedAbdelmenam AhmedAbdelmenam merged commit d122986 into dev Aug 31, 2024
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.

3 participants