Skip to content

Conversation

@fuzzkat
Copy link
Contributor

@fuzzkat fuzzkat commented Sep 12, 2025

This is an optional addition (last two commits) to PR #468 which adds a method Issue.jql_paged to query by JQL but handles paging outside of the Gem.

Alternatively this could replace the existing Issue.jql method.

freibuis was asking for this to help handle rate limiting. I've not tested it for this purpose, but it should be possible to rescue the exception while looping by doing something like this;

    issues = []
    next_page_token = nil
    loop do
      result = client.Issue.jql_paged(query,
                                      fields: %w[key],
                                      next_page_token:
                                     )

      issues += result[:issues]
      next_page_token = result[:next_page_token]

      break if next_page_token.nil?
    rescue
      # wait and try again
      sleep 1
    end

@fuzzkat fuzzkat changed the title Add jql paged to handle large queries outside of gem Add jql_paged to handle large queries outside of gem Sep 12, 2025
@fuzzkat fuzzkat force-pushed the Add_jql_paged_to_handle_large_queries_outside_of_gem branch 2 times, most recently from 5c568d5 to 7ff884e Compare September 15, 2025 17:23
@d-hansen
Copy link

I would support this change. We have tens of thousands of issues and doing a query that retrieved a large amount of them could result in consuming a lot of server memory not to much increases the order complexity of handling them. As such, we do not do any open ended .jql queries. However, if needed, we would definitely take the approach that jql_paged provides, so the system could deal with the found issues in batches.

@fuzzkat fuzzkat force-pushed the Add_jql_paged_to_handle_large_queries_outside_of_gem branch from 7ff884e to 24f9c41 Compare September 25, 2025 08:11
@fuzzkat fuzzkat force-pushed the Add_jql_paged_to_handle_large_queries_outside_of_gem branch from 24f9c41 to 095cc0f Compare October 15, 2025 09:01
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.

2 participants