Skip to content

Commit

Permalink
Revert "Fetch multiple Redmine tickets with one call"
Browse files Browse the repository at this point in the history
This reverts commit 2004136.
  • Loading branch information
ricardobranco777 committed Jun 27, 2024
1 parent 0267e5b commit 724219f
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions services/redmine.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,32 +69,6 @@ def get_issue(self, issue_id: str = "", **kwargs) -> Issue | None:
return None
return self._to_issue(info)

def get_issues(self, issues: list[dict]) -> list[Issue | None]:
try:
found = [
self._to_issue(info)
for info in self.client.issue.filter(
issue_id=",".join([issue["issue_id"] for issue in issues])
)
]
except (BaseRedmineError, RequestException) as exc:
logging.error("Redmine: %s: get_issues(): %s", self.url, exc)
return []
found_ids = {str(issue.raw["id"]) for issue in found}
not_found = [
self._not_found(
tag=f"{self.tag}#{issue['issue_id']}",
url=f"{self.url}/issues/{issue['issue_id']}",
)
for issue in issues
if issue["issue_id"] not in found_ids
]
# Old Redmine instances don't support fetching multiple issues at once
# so fetch them one by one in the base class calling get_issue() above
if len(found) == 1 and len(not_found) >= len(found):
return super().get_issues(issues)
return found + not_found # type: ignore

def _to_issue(self, info: Any) -> Issue:
return Issue(
tag=f"{self.tag}#{info.id}",
Expand Down

0 comments on commit 724219f

Please sign in to comment.