Skip to content

Commit

Permalink
unlock the engine in a case of an error
Browse files Browse the repository at this point in the history
  • Loading branch information
gregoryguillou committed Jun 29, 2022
1 parent e23ce3c commit a54c4f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,10 @@ func (e *Engine) Start(ctx context.Context) {
for {
select {
case <-e.ticker.C:
e.Lock()
if err := e.process(ctx); err != nil {
log.Err(err).Msg("Processing block.")
return
}
e.Unlock()

case <-ctx.Done():
return
Expand Down Expand Up @@ -98,6 +96,8 @@ func (e *Engine) Subscribe(ctx context.Context) {
}

func (e *Engine) process(ctx context.Context) error {
e.Lock()
defer e.Unlock()
worker := make(chan concurrently.WorkFunction, concurrency)

outputs := concurrently.Process(ctx, worker, &concurrently.Options{PoolSize: concurrency, OutChannelBuffer: concurrency})
Expand Down

0 comments on commit a54c4f5

Please sign in to comment.