velodrome/fetcher/client.go
func (client *Client) FetchIssues(latest time.Time, c chan *github.Issue) {
	opt := &github.IssueListByRepoOptions{Since: latest, Sort: "updated", State: "all", Direction: "asc"}

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

	count := 0
	for {
		client.limitsCheckAndWait()

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

		for _, issue := range issues {
			c <- issue
			count++
		}

		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issues updated issue since %v.", count, latest)
	close(c)
}
func (client *Client) FetchIssues(latest time.Time, c chan *github.Issue) {
	opt := &github.IssueListByRepoOptions{Since: latest, Sort: "updated", State: "all", Direction: "asc"}

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

	count := 0
	for {
		client.limitsCheckAndWait()

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

		for _, issue := range issues {
			c <- issue
			count++
		}

		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issues updated issue since %v.", count, latest)
	close(c)
}
func ( client * Client ) FetchIssues ( latest time . Time , c chan * github . Issue ) { opt := & github . IssueListByRepoOptions { Since : latest , Sort : " " , State : " " , Direction : " " } githubClient , err := client . getGitHubClient ( ) if err != nil { close ( c ) glog . Error ( err ) return } count := 0 for { client . limitsCheckAndWait ( ) issues , resp , err := githubClient . Issues . ListByRepo ( context . Background ( ) , client . Org , client . Project , opt , ) if err != nil { close ( c ) glog . Error ( err ) return } for _ , issue := range issues { c <- issue count ++ } if resp . NextPage == 0 { break } opt . ListOptions . Page = resp . NextPage } glog . Infof ( " " , count , latest ) close ( c ) }
// FetchIssues from GitHub, until 'latest' time
FetchIssues from GitHub until latest time