| 80 | } |
| 81 | |
| 82 | func (pool *BasePool) putToOutput(bl *baseline.Baseline) { |
| 83 | if bl.IsValid || bl.IsFuzzy { |
| 84 | bl.Collect() |
| 85 | pool.doPoc(bl) |
| 86 | } else if !bl.Collected && len(bl.Raw) > 0 { |
| 87 | bl.Extracteds.Merge(pkg.ProtonExtract(bl.Raw)) |
| 88 | } |
| 89 | out := bl.Snapshot() |
| 90 | pool.Outwg.Add(1) |
| 91 | select { |
| 92 | case pool.OutputCh <- out: |
| 93 | case <-pool.ctx.Done(): |
| 94 | // Close cancels the pool context before draining processCh. If OutputCh |
| 95 | // still has room, keep the already-produced result instead of dropping it |
| 96 | // because the local pool is shutting down. |
| 97 | select { |
| 98 | case pool.OutputCh <- out: |
| 99 | default: |
| 100 | pool.Outwg.Done() |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | func (pool *BasePool) doPoc(bl *baseline.Baseline) { |
| 106 | if !pool.Poc || len(bl.Frameworks) == 0 || bl.Url == nil { |