We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b7b9b98 commit 642cf03Copy full SHA for 642cf03
sequencing/sequencer.go
@@ -8,6 +8,7 @@ import (
8
"errors"
9
"fmt"
10
"sync"
11
+ "sync/atomic"
12
"time"
13
14
"github.com/dgraph-io/badger/v3"
@@ -359,8 +360,14 @@ func (c *Sequencer) Close() error {
359
360
// Initially the max size is set to the max blob size returned by the DA layer
361
// This can be overwritten by the execution client if it can only handle smaller size
362
func (c *Sequencer) CompareAndSetMaxSize(size uint64) {
- if size < c.maxSize {
363
- c.maxSize = size
+ for {
364
+ current := atomic.LoadUint64(&c.maxSize)
365
+ if size >= current {
366
+ return
367
+ }
368
+ if atomic.CompareAndSwapUint64(&c.maxSize, current, size) {
369
370
371
}
372
373
0 commit comments