-
Notifications
You must be signed in to change notification settings - Fork 20.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP accounts/keystore: don't scan all files, only file affected by event #15580
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move the call to rand.Seed
into func init() { ... }
. You can also remove other seed calls further down in the file.
accounts/keystore/account_cache.go
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
mtime
to see what files are changed, which does not seem to be all to stable (see #15410 and #15498).This PR instead
path
from the event, but ignores the other particulars.path
against 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.