this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make sure limiters exist before trying to set their limits in admin routes (#287)

authored by

Jaz and committed by
GitHub
d98683e5 9f8ea8fb

+7 -11
+7 -11
bgs/admin.go
··· 348 348 } 349 349 350 350 // Update the rate limit in the limiter 351 - bgs.slurper.LimitMux.RLock() 352 - limiter := bgs.slurper.Limiters[pds.ID] 353 - bgs.slurper.LimitMux.RUnlock() 351 + limiter := bgs.slurper.GetLimiter(pds.ID) 352 + if limiter == nil { 353 + limiter = rate.NewLimiter(rate.Limit(limit), 1) 354 + } 354 355 limiter.SetLimit(rate.Limit(limit)) 355 356 356 357 return e.JSON(200, map[string]any{ ··· 388 389 } 389 390 390 391 // Update the crawl limit in the limiter 391 - bgs.Index.LimitMux.RLock() 392 - limiter := bgs.Index.Limiters[pds.ID] 393 - bgs.Index.LimitMux.RUnlock() 392 + limiter := bgs.Index.GetLimiter(pds.ID) 394 393 if limiter != nil { 395 - limiter.SetLimit(rate.Limit(limit)) 396 - } else if limiter == nil { 397 - bgs.Index.LimitMux.Lock() 398 - bgs.Index.Limiters[pds.ID] = rate.NewLimiter(rate.Limit(limit), 1) 399 - bgs.Index.LimitMux.Unlock() 394 + limiter = rate.NewLimiter(rate.Limit(limit), 1) 400 395 } 396 + limiter.SetLimit(rate.Limit(limit)) 401 397 402 398 return e.JSON(200, map[string]any{ 403 399 "success": "true",