mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -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
|
m *pageMap
|
||||||
errorSender herrors.ErrorSender
|
errorSender herrors.ErrorSender
|
||||||
|
|
||||||
|
ctx context.Context
|
||||||
itemChan chan interface{}
|
itemChan chan interface{}
|
||||||
itemGroup *errgroup.Group
|
itemGroup *errgroup.Group
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *sitePagesProcessor) Process(item interface{}) error {
|
func (p *sitePagesProcessor) Process(item interface{}) error {
|
||||||
|
select {
|
||||||
|
case <-p.ctx.Done():
|
||||||
|
return nil
|
||||||
|
default:
|
||||||
p.itemChan <- item
|
p.itemChan <- item
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *sitePagesProcessor) Start(ctx context.Context) context.Context {
|
func (p *sitePagesProcessor) Start(ctx context.Context) context.Context {
|
||||||
p.itemGroup, ctx = errgroup.WithContext(ctx)
|
p.itemGroup, ctx = errgroup.WithContext(ctx)
|
||||||
|
p.ctx = ctx
|
||||||
p.itemGroup.Go(func() error {
|
p.itemGroup.Go(func() error {
|
||||||
for item := range p.itemChan {
|
for item := range p.itemChan {
|
||||||
if err := p.doProcess(item); err != nil {
|
if err := p.doProcess(item); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue