Skip to content

Commit

Permalink
Rename GitlabRPS to GitlabMaxRPS
Browse files Browse the repository at this point in the history
This makes the variable a bit clearer since we're only setting
the maximum not the actual rate. With low numbers this does
not matter much but with higher ones it can be confusing why
you're not getting the configured throughput.
  • Loading branch information
Philipp Böschen committed Nov 6, 2021
1 parent 3a170ab commit e79b86b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/crawler/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Crawler struct {
type Config struct {
GitlabHost string `conf:"required,short:g,env:GITLAB_HOST"`
GitlabToken string `conf:"required,short:t,env:GITLAB_TOKEN"`
GitlabRPS int `conf:"default:1,short:r,env:GITLAB_RPS"`
GitlabMaxRPS int `conf:"default:1,short:r,env:GITLAB_MAX_RPS"`
Neo4jHost string `conf:"default:bolt://127.0.0.1:7687,flag:neo4j-host,short:n,env:NEO4J_HOST"`
Neo4jUsername string `conf:"default:neo4j,flag:neo4j-username,short:u,env:NEO4J_USERNAME"`
Neo4jPassword string `conf:"required,flag:neo4j-password,short:w,env:NEO4J_PASSWORD"`
Expand All @@ -44,7 +44,7 @@ func New(cfg Config) (*Crawler, error) {
Client: &http.Client{
Timeout: 5 * time.Second,
},
RateLimiter: rate.NewLimiter(rate.Limit(cfg.GitlabRPS), cfg.GitlabRPS),
RateLimiter: rate.NewLimiter(rate.Limit(cfg.GitlabMaxRPS), cfg.GitlabMaxRPS),
}

gitlabClient := gitlab.NewClient(cfg.GitlabHost, cfg.GitlabToken, httpClient)
Expand Down

0 comments on commit e79b86b

Please sign in to comment.