Skip fetching feeds when work channel is >50% full to prevent DB pool exhaustion
This commit is contained in:
@@ -182,6 +182,12 @@ func (c *Crawler) StartFeedCheckLoop() {
|
||||
return
|
||||
}
|
||||
|
||||
// Only fetch more work when the channel has space
|
||||
if len(workChan) > fetchSize/2 {
|
||||
time.Sleep(1 * time.Second)
|
||||
continue
|
||||
}
|
||||
|
||||
feeds, err := c.GetFeedsDueForCheck(fetchSize)
|
||||
if err != nil {
|
||||
fmt.Printf("Error fetching feeds: %v\n", err)
|
||||
|
||||
Reference in New Issue
Block a user