From d7cd6f348cae0f5b98ad1710f93433de9dca625a Mon Sep 17 00:00:00 2001 From: Aaron Lindsay Date: Sun, 8 Sep 2013 22:13:04 -0400 Subject: [PATCH] Update timestamp on events even if they match If we don't do this, we don't maintain the invariant that the timestamp of the latest locally-stored event for a path is the last time this path was updated. Not maintaining this invariant can cause to incorrect behavior (i.e. files being deleted when they shouldn't). --- asink/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asink/client.go b/asink/client.go index 461bbdb..be180ba 100644 --- a/asink/client.go +++ b/asink/client.go @@ -236,10 +236,13 @@ func ProcessRemoteEvent(globals AsinkGlobals, event *asink.Event) { //if we already have this event, or if it is older than our most recent event, bail out if latestLocal != nil { - if event.Timestamp < latestLocal.Timestamp || event.IsSameEvent(latestLocal) { + if event.Timestamp < latestLocal.Timestamp { event.LocalStatus |= asink.DISCARDED return } + if event.IsSameEvent(latestLocal) { + return + } if latestLocal.Hash != event.Predecessor && latestLocal.Hash != event.Hash { fmt.Printf("conflict:\n")