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

Redundant request when the limit is more than the nearest multiple of hundred from the total_count #436

Open
akindemirci opened this issue Nov 18, 2024 · 2 comments · May be fixed by #440
Labels
possible bug Issue is possibly a bug, needs investigation

Comments

@akindemirci
Copy link

akindemirci commented Nov 18, 2024

In AbstractApi.php, the function retrieveData makes a redundant final request if the limit is defined over 200.

On line 357, the if statement to reset $limit to zero and end the while loop is currently like this:

$newDataSet['offset'] >= $newDataSet['total_count']

This way, the while loop continues for another request whose result will be definitely empty.

I think it should be like this:

$newDataSet['limit'] + $newDataSet['offset'] >= $newDataSet['total_count']

Thanks.

@akindemirci akindemirci changed the title Redunant request when limit is over 200 Redundant request when limit is over 200 Nov 18, 2024
@Art4 Art4 added the possible bug Issue is possibly a bug, needs investigation label Jan 21, 2025
@Art4 Art4 linked a pull request Jan 21, 2025 that will close this issue
@Art4
Copy link
Collaborator

Art4 commented Jan 21, 2025

Thank you for filing this issue. I've created a test in #440, but cannot reproduce it. Could you please take a look at the test code or could you precise the circumstances of this issue? Thank you.

@akindemirci
Copy link
Author

Thanks for looking into this issue.

I realized that the condition I wrote the first time for the issue was not exactly true. The precise condition is this:

  • When the limit is more than the nearest multiple of hundred from the total_count (including itself), the issue arises.

No issue when: total_count = 250; limit = 300
The issue exists when: total_count = 250; limit = 301
(limit is more than the nearest multiple of hundred from 250 which is 300)

No issue when: total_count = 100; limit = 100
The issue exists when: total_count = 100; limit = 101
(limit is more than the nearest multiple of hundred from 100 (including itself) which is 100)

It should make one request if the total_count is 100, even if the limit is defined more than this.

@akindemirci akindemirci changed the title Redundant request when limit is over 200 Redundant request when the limit is more than the nearest multiple of hundred from the total_count Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possible bug Issue is possibly a bug, needs investigation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants