mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 07:58:22 -05:00
add lock (#4739)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"sort"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -24,8 +25,11 @@ var processPendingBlocksPeriod = time.Duration(params.BeaconConfig().SecondsPerS
|
||||
// processes pending blocks queue on every processPendingBlocksPeriod
|
||||
func (r *Service) processPendingBlocksQueue() {
|
||||
ctx := context.Background()
|
||||
locker := new(sync.Mutex)
|
||||
runutil.RunEvery(r.ctx, processPendingBlocksPeriod, func() {
|
||||
locker.Lock()
|
||||
r.processPendingBlocks(ctx)
|
||||
locker.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user