Skip to content

Commit

Permalink
indexer_scheduler teak
Browse files Browse the repository at this point in the history
  • Loading branch information
brianolson committed Dec 17, 2024
1 parent 62ddc08 commit 460999a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions indexer/crawler.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ func (c *CrawlDispatcher) mainLoop() {
limiter := c.repoFetcher.GetOrCreateLimiterLazy(pdsID)
now := time.Now()
avail := limiter.TokensAt(now)
if avail > 1 {
if avail >= 1.0 {
crawlJob.eligibleTime = now
} else {
rate := float64(limiter.Limit())
need := 1 - avail
need := 1.0 - avail
wouldDelay := time.Duration(float64(time.Second) * need / rate)
crawlJob.eligibleTime = now.Add(wouldDelay)
}
Expand Down

0 comments on commit 460999a

Please sign in to comment.