mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
Fix "stuck on build" in error situations in content processing
Updates #8166
This commit is contained in:
parent
9eb05807c6
commit
bd63c1aa56
1 changed files with 8 additions and 1 deletions
|
@ -115,17 +115,24 @@ type sitePagesProcessor struct {
|
|||
m *pageMap
|
||||
errorSender herrors.ErrorSender
|
||||
|
||||
ctx context.Context
|
||||
itemChan chan interface{}
|
||||
itemGroup *errgroup.Group
|
||||
}
|
||||
|
||||
func (p *sitePagesProcessor) Process(item interface{}) error {
|
||||
p.itemChan <- item
|
||||
select {
|
||||
case <-p.ctx.Done():
|
||||
return nil
|
||||
default:
|
||||
p.itemChan <- item
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *sitePagesProcessor) Start(ctx context.Context) context.Context {
|
||||
p.itemGroup, ctx = errgroup.WithContext(ctx)
|
||||
p.ctx = ctx
|
||||
p.itemGroup.Go(func() error {
|
||||
for item := range p.itemChan {
|
||||
if err := p.doProcess(item); err != nil {
|
||||
|
|
Loading…
Reference in a new issue