repo: avoid race condition causing multiple syncups at the same time

This commit is contained in:
Hylke Bons 2012-07-14 14:35:55 +02:00
parent e7cea2bff6
commit 2d8a02692a

View file

@ -206,20 +206,21 @@ namespace SparkleLib {
public void OnFileActivity (FileSystemEventArgs args) public void OnFileActivity (FileSystemEventArgs args)
{ {
lock (this.change_lock) { if (IsBuffering)
this.remote_timer.Stop (); return;
string relative_path = args.FullPath.Replace (LocalPath, ""); string relative_path = args.FullPath.Replace (LocalPath, "");
foreach (string exclude_path in ExcludePaths) { foreach (string exclude_path in ExcludePaths) {
if (relative_path.Contains (exclude_path)) { if (relative_path.Contains (exclude_path))
this.remote_timer.Start ();
return; return;
} }
}
if (!IsBuffering && HasLocalChanges) { if (IsBuffering || !HasLocalChanges)
return;
IsBuffering = true; IsBuffering = true;
this.remote_timer.Stop ();
SparkleHelpers.DebugInfo ("Local", Name + " | Activity detected, waiting for it to settle..."); SparkleHelpers.DebugInfo ("Local", Name + " | Activity detected, waiting for it to settle...");
@ -259,11 +260,10 @@ namespace SparkleLib {
} }
} while (IsBuffering); } while (IsBuffering);
}
this.remote_timer.Start (); this.remote_timer.Start ();
} }
}
protected void OnConflictResolved () protected void OnConflictResolved ()