about summary refs log tree commit diff
path: root/LibMatrix/Helpers
diff options
context:
space:
mode:
authorEmma [it/its]@Rory& <root@rory.gay>2024-02-23 12:33:45 +0100
committerEmma [it/its]@Rory& <root@rory.gay>2024-02-23 12:33:55 +0100
commitc7b7dbe3d929d787fe0c76015082a117c4222278 (patch)
treedb765a9655f875d751f061e1000e199dd209d841 /LibMatrix/Helpers
parentHS emulator (diff)
downloadLibMatrix-c7b7dbe3d929d787fe0c76015082a117c4222278.tar.xz
Unknown changes
Diffstat (limited to 'LibMatrix/Helpers')
-rw-r--r--LibMatrix/Helpers/SyncHelper.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/LibMatrix/Helpers/SyncHelper.cs b/LibMatrix/Helpers/SyncHelper.cs
index 47e5b1e..f9a7cb7 100644
--- a/LibMatrix/Helpers/SyncHelper.cs
+++ b/LibMatrix/Helpers/SyncHelper.cs
@@ -120,7 +120,7 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg
     }
 
     public async Task RunSyncLoopAsync(bool skipInitialSyncEvents = true, CancellationToken? cancellationToken = null) {
-        var sw = Stopwatch.StartNew();
+        // var sw = Stopwatch.StartNew();
         var emptyInitialSyncCount = 0;
         var syncCount = 0;
         var oldTimeout = Timeout;
@@ -153,7 +153,7 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg
                     Timeout = oldTimeout;
                 }
             }
-            else if (syncCount > 15)
+            else if (syncCount > 15 && IsInitialSync)
                 Console.WriteLine(sync.ToJson(ignoreNull: true, indent: true));
 
             await RunSyncLoopCallbacksAsync(sync, IsInitialSync && skipInitialSyncEvents);
@@ -212,4 +212,9 @@ public class SyncHelper(AuthenticatedHomeserverGeneric homeserver, ILogger? logg
     /// Event fired when an account data event is received
     /// </summary>
     public List<Func<StateEventResponse, Task>> AccountDataReceivedHandlers { get; } = new();
+    
+    private void Log(string message) {
+        if (logger is null) Console.WriteLine(message);
+        else logger.LogInformation(message);
+    }
 }
\ No newline at end of file