This is an automated email from the ASF dual-hosted git repository. knaufk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink-jira-bot.git
The following commit(s) were added to refs/heads/master by this push: new 7740c78 [FLINK-22783] do not count tickets with updated subtasks against ticket limit new f6e7e9c Merge pull request #17 from knaufk/FLINK-22783 7740c78 is described below commit 7740c782e3c92893fe901ffc4454dcdb28e7f3d1 Author: Konstantin Knauf <knauf.konstan...@gmail.com> AuthorDate: Wed May 26 14:22:52 2021 +0200 [FLINK-22783] do not count tickets with updated subtasks against ticket limit --- flink_jira_rule.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/flink_jira_rule.py b/flink_jira_rule.py index 0ded937..91c45ca 100644 --- a/flink_jira_rule.py +++ b/flink_jira_rule.py @@ -34,7 +34,7 @@ class FlinkJiraRule: self.warning_comment = config["warning_comment"].get() self.ticket_limit = config["ticket_limit"].get() - def get_issues(self, jql_query, limit): + def get_issues(self, jql_query, limit=10000): """Queries the JIRA PI for all issues that match the given JQL Query This method is necessary as requests tend to time out if the number of results reaches a certain number. @@ -82,9 +82,12 @@ class FlinkJiraRule: def mark_stale_tickets_stale(self, jql_query): logging.info(f"Looking for stale tickets.") - issues = self.get_issues(jql_query, self.ticket_limit) + issues = self.get_issues(jql_query) - for issue in issues: + updated_issues_counter = 0 + i = 0 + while i < len(issues) and updated_issues_counter <= self.ticket_limit: + issue = issues[i] key = issue["key"] if not self.has_recently_updated_subtask(key, self.stale_days): @@ -99,11 +102,14 @@ class FlinkJiraRule: self.add_label_with_comment(key, self.warning_label, formatted_comment) + updated_issues_counter += 1 + else: logging.info( f"Found https://issues.apache.org/jira/browse/{key}, but is has recently updated Subtasks." f"Ignoring for now." ) + i += 1 def handle_tickets_marked_stale(self, jql_query): logging.info(f"Looking for ticket previously marked as {self.warning_label}.")