diff --git a/indexer/crawler.go b/indexer/crawler.go index 0dc9cfb8..794ac779 100644 --- a/indexer/crawler.go +++ b/indexer/crawler.go @@ -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) }