Skip to content

Instantly share code, notes, and snippets.

@Lorac
Created February 21, 2018 13:23
Show Gist options
  • Save Lorac/6cef9747e6e668e99b4c246bfe8d9408 to your computer and use it in GitHub Desktop.
Save Lorac/6cef9747e6e668e99b4c246bfe8d9408 to your computer and use it in GitHub Desktop.
Ratelimit gitlab
package main
import (
"fmt"
"sync"
gitlab "github.com/xanzy/go-gitlab"
)
func main() {
// See the separate files in this directory for the examples. This file is only
// here to provide a main() function for the `example` package, keeping Travis happy.
git := gitlab.NewClient(nil, "")
var wg sync.WaitGroup
wg.Add(5)
go func() {
defer wg.Done()
for i := 0; i < 650; i++ {
_, resp, err := git.Projects.GetProject(13083) // Get GitlabProject
fmt.Println(resp.Header)
fmt.Println(resp)
fmt.Println(err)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 650; i++ {
_, resp, err := git.Projects.GetProject(13083) // Get GitlabProject
fmt.Println(resp.Header)
fmt.Println(resp)
fmt.Println(err)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 650; i++ {
_, resp, err := git.Projects.GetProject(13083) // Get GitlabProject
fmt.Println(resp.Header)
fmt.Println(resp)
fmt.Println(err)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 650; i++ {
_, resp, err := git.Projects.GetProject(13083) // Get GitlabProject
fmt.Println(resp.Header)
fmt.Println(resp)
fmt.Println(err)
}
}()
go func() {
defer wg.Done()
for i := 0; i < 650; i++ {
_, resp, err := git.Projects.GetProject(13083) // Get GitlabProject
fmt.Println(resp.Header)
fmt.Println(resp)
fmt.Println(err)
}
}()
wg.Wait()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment