mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
accounts: retry account renaming to avoid sync races
This commit is contained in:
parent
80ea44c485
commit
3980d3bf47
1 changed files with 7 additions and 1 deletions
|
|
@ -207,7 +207,13 @@ func writeKeyFile(file string, content []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
f.Close()
|
f.Close()
|
||||||
|
|
||||||
|
if err := os.Rename(f.Name(), file); err != nil {
|
||||||
|
// Renaming failed, may be a data race between a cache sync, retry
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
return os.Rename(f.Name(), file)
|
return os.Rename(f.Name(), file)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// keyFileName implements the naming convention for keyfiles:
|
// keyFileName implements the naming convention for keyfiles:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue