velodrome/fetcher/client.go
func (client *Client) FetchIssueComments(issueID int, latest time.Time, c chan *github.IssueComment) {
	opt := &github.IssueListCommentsOptions{Since: latest, Sort: "updated", Direction: "asc"}

	githubClient, err := client.getGitHubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		comments, resp, err := githubClient.Issues.ListComments(
			context.Background(),
			client.Org,
			client.Project,
			issueID,
			opt,
		)
		if err != nil {
			close(c)
			glog.Error(err)
			return
		}

		for _, comment := range comments {
			c <- comment
			count++
		}
		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issue comments updated since %v for issue #%d.", count, latest, issueID)
	close(c)
}
func (client *Client) FetchIssueComments(issueID int, latest time.Time, c chan *github.IssueComment) {
	opt := &github.IssueListCommentsOptions{Since: latest, Sort: "updated", Direction: "asc"}

	githubClient, err := client.getGitHubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		comments, resp, err := githubClient.Issues.ListComments(
			context.Background(),
			client.Org,
			client.Project,
			issueID,
			opt,
		)
		if err != nil {
			close(c)
			glog.Error(err)
			return
		}

		for _, comment := range comments {
			c <- comment
			count++
		}
		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issue comments updated since %v for issue #%d.", count, latest, issueID)
	close(c)
}
func ( client * Client ) FetchIssueComments ( issueID int , latest time . Time , c chan * github . IssueComment ) { opt := & github . IssueListCommentsOptions { Since : latest , Sort : " " , Direction : " " } githubClient , err := client . getGitHubClient ( ) if err != nil { close ( c ) glog . Error ( err ) return } count := 0 for { client . limitsCheckAndWait ( ) comments , resp , err := githubClient . Issues . ListComments ( context . Background ( ) , client . Org , client . Project , issueID , opt , ) if err != nil { close ( c ) glog . Error ( err ) return } for _ , comment := range comments { c <- comment count ++ } if resp . NextPage == 0 { break } opt . ListOptions . Page = resp . NextPage } glog . Infof ( " " , count , latest , issueID ) close ( c ) }
// FetchIssueComments fetches comments associated to given Issue (since latest)
FetchIssueComments fetches comments associated to given Issue ( since latest )