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

Pagination arguments are ignored in Issues search #18

Open
makcyd opened this issue Jun 25, 2024 · 0 comments
Open

Pagination arguments are ignored in Issues search #18

makcyd opened this issue Jun 25, 2024 · 0 comments

Comments

@makcyd
Copy link

makcyd commented Jun 25, 2024

Description

We are using yandex_tracker_client as a library on a backend to perform issue search in Yandex Tracker, where our backend app receives request from our frontend app and performs issue search depending on the issue tracker configured in the system.

The pagination controls are implemented on the front-end and are passed as parameters to client.issues.find() method to show, say, only the first page with 10 items on it. However, these parameters are ignored and client iterates over all results array, leading to Error 429 from Yandex Tracker.

That's, as we suspect, because of this method override:
https://github.com/yandex/yandex_tracker_client/blob/master/yandex_tracker_client/collections.py#L95

Steps to reproduce:

  1. Perform issue search as follows:
from yandex_tracker_client import TrackerClient

client = TrackerClient(token=YANDEX_OAUTH_TOKEN, org_id=YANDEX_ORG_ID, cloud_org_id=CLOUD_ORG_ID)

query = 'Key: test OR Summary: test OR Description: test'
search = client.issues.find(
    query,
    page=1,
    per_page=10)
for issue in search:
    print(issue)

Expected outcome:

Only first page of the search is returned with 10 items on it

Actual outcome:

  1. Client iterates over all results, making more than 1 request
  2. As a result, Error 429 is returned by Yandex Tracker API

Additional information

We can see how auto-iteration through all results may be useful, so probably it's worth creating two methods - findAll() that automatically iterates over all results, and the find() that obey the provided pagination parameters.

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

No branches or pull requests

1 participant