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).
This commit is contained in:
Aaron Lindsay 2013-09-08 22:13:04 -04:00
parent 793e4eb6b2
commit d7cd6f348c

View File

@ -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")