mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 11:12:44 +00:00
sync: prevent multiple syncs from a single connection
This commit is contained in:
@@ -111,7 +111,9 @@ namespace Notesnook.API.Hubs
|
||||
var userId = Context.User.FindFirstValue("sub");
|
||||
if (string.IsNullOrEmpty(userId)) return 0;
|
||||
|
||||
var others = Clients.OthersInGroup(userId);
|
||||
// Only allow a single sync to run per connection. This prevents a bunch of issues like sync loops
|
||||
// and wasted bandwidth
|
||||
if (GlobalSync.IsSyncRunning(userId, Context.ConnectionId)) return 0;
|
||||
|
||||
if (!GlobalSync.RunningSyncs.ContainsKey(userId))
|
||||
GlobalSync.RunningSyncs[userId] = new List<RunningSync>();
|
||||
|
||||
Reference in New Issue
Block a user