Skip to content
This repository has been archived by the owner on Sep 21, 2023. It is now read-only.

Fix Jira API request only returning 50 tickets #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ func CompareIssues(config cfg.Config, ghClient clients.GitHubClient, jiraClient
ids[i] = v.GetID()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due do this patch, this slice is never used. We should eliminate this loop and then this PR is good.

}

jiraIssues, err := jiraClient.ListIssues(ids)
if err != nil {
return err
}

log.Debug("Collected all JIRA issues")

for _, ghIssue := range ghIssues {
found := false

ids := make([]int, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could same some time by allocating this slice only once, before the loop, and then reusing it.

ids[0] = *ghIssue.ID
jiraIssues, err := jiraClient.ListIssues(ids)
if err != nil {
return err
}

for _, jIssue := range jiraIssues {
id, _ := jIssue.Fields.Unknowns.Int(config.GetFieldKey(cfg.GitHubID))
if int64(*ghIssue.ID) == id {
Expand Down