stream-chat-android
stream-chat-android copied to clipboard
Investigate sync performance issue
I noticed that SyncManager.connectionRecovered method sometimes takes up to 1 min.
2022-05-26 12:50:47.929 13169-13495/io.getstream.chat.android.compose.sample.debug D/Chat:SyncManager: [connectionRecovered] firstConnect: false
2022-05-26 12:51:47.980 13169-13495/io.getstream.chat.android.compose.sample.debug V/Chat:SyncManager: [connectionRecovered] completed
It was happening on my end after enabling & disabling airplane mode.
The issue is happening due to 2 QueryChannelsRequest requests being fired from SyncManager.connectionRecovered method.
If the user has a poor connection, or glitching network layer (like on my end with emulator), the connectionRecovered may get stuck up to 1 minute until it gets EOF or Timeout.
This happens after SDK receives a HealthEvent, which means we turned UI into a Connected state.
It feels like there is a lack of some sort of Syncing state to be displayed.
Plus I'm not really sure for what reason we do call QueryChannelsRequest twice on connection restoration.
This is a subject to be discussed with other Core team members.
cc @adasiewiczr, @JcMinarro, @amitkma, @leandroBorgesFerreira
Needs some changes on the backend side. Putting to backlog