WIP accounts/keystore: don't scan all files, only file affected by event#15580
WIP accounts/keystore: don't scan all files, only file affected by event#15580holiman wants to merge 5 commits into
Conversation
|
Failures: I wonder if the |
|
Hm, I don't see what's wrong with this, looks correct to me: |
|
Oh: The |
|
Same error on However, the So, afaict, this actually does work, but there's some issue with resolving the paths properly. |
|
This is the problem:https://stackoverflow.com/questions/45122459/docker-mounts-denied-the-paths-are-not-shared-from-os-x-and-are-not-known/45123074#45123074
The go-test is using so |
|
The PR seems to work, the remaining travis-failure does not seem to be related (https://travis-ci.org/ethereum/go-ethereum/jobs/309404326) |
| if err != nil { | ||
| return "", err | ||
| } | ||
| return filepath.Join(tmpdir, fmt.Sprintf("eth-keystore-watch-test-%d-%d", os.Getpid(), rand.Int())), nil |
There was a problem hiding this comment.
Please move the call to rand.Seed into func init() { ... }. You can also remove other seed calls further down in the file.
| creates, deletes, updates, err := ac.fileC.scan(ac.keydir) | ||
| // readAccount is a helper-function to read an encrypted keyfile | ||
| func readAccount(path string, buf *bufio.Reader) *accounts.Account { | ||
|
|
There was a problem hiding this comment.
Please remove blank lines at the beginning and end of functions.
|
I'm fine with how the code looks now, but tests are still flaking. |
|
Sigh, you're right. The appveyor one is a swarm-test going OOM, but the travis test is exactly the type of error that this PR aims to solve. Let's not merge this at the moment, I'll see if I have some time to fix it up perhaps after christmas. |
|
The only question is: which Christmas? |
In the current codebase, whenever the watcher receives notifications about changes in the keystore directory, it triggers a rescan of files in the directory. This scan uses
mtimeto see what files are changed, which does not seem to be all to stable (see #15410 and #15498).This PR instead
pathfrom the event, but ignores the other particulars.pathagainst already known files/accounts, to determine if the file was modified, changed, or deleted (or nothing)See https://godoc.org/github.com/rjeczalik/notify for info about the notify library.
The PR fixes #15410 (comment) , and reverts #15498, since those changes are seemingly no longer needed.