mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
Update core/rawdb/freezer.go
Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
parent
ab93f65056
commit
30910de62d
1 changed files with 3 additions and 5 deletions
|
|
@ -108,11 +108,9 @@ func NewFreezer(datadir string, namespace string, readonly bool, maxTableSize ui
|
||||||
// Leveldb uses LOCK as the filelock filename. To prevent the
|
// Leveldb uses LOCK as the filelock filename. To prevent the
|
||||||
// name collision, we use FLOCK as the lock name.
|
// name collision, we use FLOCK as the lock name.
|
||||||
lock := flock.New(flockFile)
|
lock := flock.New(flockFile)
|
||||||
tryLock := func() (bool, error) {
|
tryLock := lock.TryLock
|
||||||
if readonly {
|
if readonly {
|
||||||
return lock.TryRLock()
|
tryLock = lock.TryRLock
|
||||||
}
|
|
||||||
return lock.TryLock()
|
|
||||||
}
|
}
|
||||||
if locked, err := tryLock(); err != nil {
|
if locked, err := tryLock(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue