From 6187926685659e1ee52ec13de873c26cf8919464 Mon Sep 17 00:00:00 2001 From: nielsandriesse Date: Sat, 9 May 2020 09:34:09 +1000 Subject: [PATCH] Add comment --- .../Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift | 2 ++ .../Loki/Protocol/Sync Messages/SyncMessagesProtocol.swift | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift b/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift index aa0c666b8..6109865c0 100644 --- a/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift +++ b/SignalServiceKit/src/Loki/Protocol/Closed Groups/ClosedGroupsProtocol.swift @@ -43,6 +43,8 @@ public final class ClosedGroupsProtocol : NSObject { thread.save(with: transaction) let sessionRequestMessage = SessionRequestMessage(thread: thread) let messageSenderJobQueue = SSKEnvironment.shared.messageSenderJobQueue + // This has to happen sync to ensure that session requests get sent before AFRs do (it's + // asssumed that the master device first syncs closed groups first and contacts after that). messageSenderJobQueue.add(message: sessionRequestMessage, transaction: transaction) } } diff --git a/SignalServiceKit/src/Loki/Protocol/Sync Messages/SyncMessagesProtocol.swift b/SignalServiceKit/src/Loki/Protocol/Sync Messages/SyncMessagesProtocol.swift index d1995d13d..e9b338d6b 100644 --- a/SignalServiceKit/src/Loki/Protocol/Sync Messages/SyncMessagesProtocol.swift +++ b/SignalServiceKit/src/Loki/Protocol/Sync Messages/SyncMessagesProtocol.swift @@ -175,7 +175,10 @@ public final class SyncMessagesProtocol : NSObject { case .none, .requestExpired: // We need to send the FR message to all of the user's devices as the contact sync message excludes slave devices let autoGeneratedFRMessage = MultiDeviceProtocol.getAutoGeneratedMultiDeviceFRMessage(for: hexEncodedPublicKey, in: transaction) - // This takes into account multi device + // Use the message sender job queue for this to ensure that these messages get sent + // AFTER session requests (it's asssumed that the master device first syncs closed + // groups first and contacts after that). + // This takes into account multi device. let messageSenderJobQueue = SSKEnvironment.shared.messageSenderJobQueue messageSenderJobQueue.add(message: autoGeneratedFRMessage, transaction: transaction) case .requestReceived: