From e2c356a723cedf88936c4d7b394626c27125ad6b Mon Sep 17 00:00:00 2001 From: Mario Steele Date: Wed, 30 Jul 2025 12:52:31 -0500 Subject: [PATCH] Updated Syncer Added check for syncing. If we are syncing, we should be expecting file changes, and not do anything. --- FreeTubeSyncer/REST/Syncer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/FreeTubeSyncer/REST/Syncer.cs b/FreeTubeSyncer/REST/Syncer.cs index 80941fc..c984257 100644 --- a/FreeTubeSyncer/REST/Syncer.cs +++ b/FreeTubeSyncer/REST/Syncer.cs @@ -29,6 +29,7 @@ public class Syncer : ISyncer where T : class, IDataModel, new() private string _restEndpoint; private bool _isDirty = false; + private bool _syncing = false; public Syncer(DBSyncWatcher watcher, string dbPath, string dbName, string restEndpoint) { @@ -97,6 +98,8 @@ public class Syncer : ISyncer where T : class, IDataModel, new() { if (dbName != _dbName) return; + if (_syncing) + return; T? entry; try @@ -129,6 +132,7 @@ public class Syncer : ISyncer where T : class, IDataModel, new() { if (!_isDirty) return; + _syncing = true; Console.WriteLine($"Syncing {_dbPath}..."); var json = new List(); foreach (var entry in _entries) @@ -136,5 +140,6 @@ public class Syncer : ISyncer where T : class, IDataModel, new() File.WriteAllLines(_dbPath, json); Console.WriteLine($"Updated {_dbPath}."); _isDirty = false; + _syncing = false; } } \ No newline at end of file