Skip to content

Commit

Permalink
Merge pull request #16 from gregoryguillou/bugfix/unlock-on-process-f…
Browse files Browse the repository at this point in the history
…ailed
  • Loading branch information
tarrencev authored Jun 29, 2022
2 parents e23ce3c + a54c4f5 commit 1971f33
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 1971f33

Please sign in to comment.