Skip to content

Pagination arguments are ignored in Issues search #18

@makcyd

Description

@makcyd

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions