refactor: standardize article header layout in UI and increase worker pool capacity
This commit is contained in:
@@ -60,6 +60,9 @@ func (e *Evaluator) resolveField(field string, entry models.FeedEntry) interface
|
||||
return entry.URL
|
||||
case "content", "raw_content", "rss_content":
|
||||
var parts []string
|
||||
if entry.Title != "" {
|
||||
parts = append(parts, entry.Title)
|
||||
}
|
||||
if entry.Content != "" {
|
||||
parts = append(parts, entry.Content)
|
||||
}
|
||||
|
||||
+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