From 599ba6032ef01ffa520b54451012fd7c233e07e9 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Tue, 31 Oct 2017 22:22:10 -0500 Subject: [PATCH 1/2] accounts/keystore: fix cache update and TestUpdatedKeyfileContents failing on macOS --- accounts/keystore/account_cache.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index 4b08cc2029..96f514cf0b 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -23,6 +23,7 @@ import ( "io/ioutil" "os" "path/filepath" + "runtime" "sort" "strings" "sync" @@ -260,7 +261,8 @@ func (fc *fileCache) scanFiles(keyDir string) (set.Interface, set.Interface, set continue } filesNow.Add(path) - if modTime.After(prevMtime) { + // on macOS, we get FS notifications before the actual modTime is updated + if modTime.After(prevMtime) || (modTime.Equal(prevMtime) && runtime.GOOS == "darwin") { moddedFiles.Add(path) } if modTime.After(newMtime) { From 6407276e7f5d75a29fd9d0b0c7bc606a76bcd164 Mon Sep 17 00:00:00 2001 From: Gautam Botrel Date: Mon, 6 Nov 2017 10:47:17 -0600 Subject: [PATCH 2/2] accounts/keystore: fix cache update, removed platform specific code --- accounts/keystore/account_cache.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/accounts/keystore/account_cache.go b/accounts/keystore/account_cache.go index 96f514cf0b..1d91a79c35 100644 --- a/accounts/keystore/account_cache.go +++ b/accounts/keystore/account_cache.go @@ -23,7 +23,6 @@ import ( "io/ioutil" "os" "path/filepath" - "runtime" "sort" "strings" "sync" @@ -262,7 +261,7 @@ func (fc *fileCache) scanFiles(keyDir string) (set.Interface, set.Interface, set } filesNow.Add(path) // on macOS, we get FS notifications before the actual modTime is updated - if modTime.After(prevMtime) || (modTime.Equal(prevMtime) && runtime.GOOS == "darwin") { + if modTime.After(prevMtime) || modTime.Equal(prevMtime) { moddedFiles.Add(path) } if modTime.After(newMtime) {