velodrome/fetcher/client.go
func (client *Client) FetchIssueEvents(issueID int, latest *int, c chan *github.IssueEvent) {
	opt := &github.ListOptions{PerPage: 100}

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

	count := 0
	for {
		client.limitsCheckAndWait()

		events, resp, err := githubClient.Issues.ListIssueEvents(
			context.Background(),
			client.Org,
			client.Project,
			issueID,
			opt,
		)
		if err != nil {
			glog.Errorf("ListIssueEvents failed: %s. Retrying...", err)
			time.Sleep(time.Second)
			continue
		}

		for _, event := range events {
			c <- event
			count++
		}
		if resp.NextPage == 0 || (latest != nil && hasID(events, *latest)) {
			break
		}
		opt.Page = resp.NextPage
	}

	glog.Infof("Fetched %d events.", count)
	close(c)
}
func (client *Client) FetchIssueEvents(issueID int, latest *int, c chan *github.IssueEvent) {
	opt := &github.ListOptions{PerPage: 100}

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

	count := 0
	for {
		client.limitsCheckAndWait()

		events, resp, err := githubClient.Issues.ListIssueEvents(
			context.Background(),
			client.Org,
			client.Project,
			issueID,
			opt,
		)
		if err != nil {
			glog.Errorf("ListIssueEvents failed: %s. Retrying...", err)
			time.Sleep(time.Second)
			continue
		}

		for _, event := range events {
			c <- event
			count++
		}
		if resp.NextPage == 0 || (latest != nil && hasID(events, *latest)) {
			break
		}
		opt.Page = resp.NextPage
	}

	glog.Infof("Fetched %d events.", count)
	close(c)
}
// FetchIssueEvents from github and return the full list, until it matches 'latest'
// The entire last page will be included so you can have redundancy.