From 53b7ba30900e94f5fddffcae8d78a90d115a1c87 Mon Sep 17 00:00:00 2001 From: John Strunk Date: Tue, 21 May 2024 21:03:13 +0000 Subject: [PATCH] Adjust jira API call delay to 0.25 seconds Signed-off-by: John Strunk --- jiraissues.py | 2 +- summarizer.py | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/jiraissues.py b/jiraissues.py index 6151f52..7201eed 100644 --- a/jiraissues.py +++ b/jiraissues.py @@ -19,7 +19,7 @@ CF_STATUS_SUMMARY = "customfield_12320841" # string # How long to delay between API calls -MIN_CALL_DELAY: float = 0.2 +MIN_CALL_DELAY: float = 0.25 @dataclass diff --git a/summarizer.py b/summarizer.py index f8f041e..0e74757 100644 --- a/summarizer.py +++ b/summarizer.py @@ -19,7 +19,14 @@ from langchain_core.language_models import LLM import text_wrapper -from jiraissues import Issue, RelatedIssue, descendants, get_self, issue_cache +from jiraissues import ( + Issue, + RelatedIssue, + check_response, + descendants, + get_self, + issue_cache, +) _logger = logging.getLogger(__name__) @@ -334,13 +341,13 @@ def get_issues_to_summarize( # user, so we need to convert user_zi = get_self(client).tzinfo since_string = since.astimezone(user_zi).strftime("%Y-%m-%d %H:%M") - updated_issues = client.jql( - f"labels = '{SUMMARY_ALLOWED_LABEL}' and updated >= '{since_string}' ORDER BY updated DESC", - limit=50, - fields="key,updated", + updated_issues = check_response( + client.jql( + f"labels = '{SUMMARY_ALLOWED_LABEL}' and updated >= '{since_string}' ORDER BY updated DESC", # pylint: disable=line-too-long + limit=50, + fields="key,updated", + ) ) - if not isinstance(updated_issues, dict): - return [] keys: List[str] = [issue["key"] for issue in updated_issues["issues"]] # Filter out any issues that are not in the allowed projects filtered_keys = []