1
0
Fork 0
mirror of https://github.com/gohugoio/hugo.git synced 2025-04-13 15:45:49 +00:00

Fix "stuck on build" in error situations in content processing

Updates 
This commit is contained in:
Bjørn Erik Pedersen 2021-12-22 19:00:32 +01:00
parent 759cdf3fc8
commit 0b918e131f
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F

View file

@ -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 {