refactor: standardize article header layout in UI and increase worker pool capacity
This commit is contained in:
+14
-2
@@ -77,10 +77,22 @@ func (p *Pool) Stop() {
|
||||
}
|
||||
|
||||
func (p *Pool) Dispatch(ctx context.Context, action models.RuleAction, entry models.FeedEntry, depth int) {
|
||||
task := Task{Action: action, Entry: entry, Depth: depth}
|
||||
select {
|
||||
case p.queue <- Task{Action: action, Entry: entry, Depth: depth}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case p.queue <- task:
|
||||
return
|
||||
default:
|
||||
p.log.Warn("Worker pool queue full, task dropped",
|
||||
}
|
||||
|
||||
// If queue is full, wait up to 5 seconds for a slot before warning
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case p.queue <- task:
|
||||
case <-time.After(5 * time.Second):
|
||||
p.log.Warn("Worker pool queue full, task dropped after timeout",
|
||||
zap.String("action", action.Type),
|
||||
zap.String("entry_id", entry.ID),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user