Welcome to New Expensify: a complete re-imagination of financial collaboration, centered around chat. Help us build the next generation of Expensify by sharing feedback and contributing to the code.
When a user opens the chat app after a period of inactivity/activity/actions, the NetworkQueue is filled with a large queue of unsent requests. This queue causes significant processing delays, which result in app hangs and infinite loading of messages, preventing users from having a seamless messaging experience.
Solution
To address this problem, consider implementing background task processing that allows the app to handle network requests even when not actively open. For mobile (Android/iOS), you could utilize:
For Android: Use WorkManager to manage background tasks reliably.
For iOS: Implement Background Fetch to periodically process network requests.
For both: Consider using React Native Background Fetch or https://reactnative.dev/docs/headless-js-android
Additional Solutions for Web and Desktop
Web: Leverage Service Workers for handling background sync when internet connection is re-established.
Desktop: Use Electron’s background task handling capabilities (e.g., electron-ipc).
Cases:
User is offline or in a poor network connection
User takes some actions and serializes network requests
User puts app in the background
User regains network connection, requests from the queue start executing.
User opens the app and has no remaining network requests (or maybe a few)
Open the app from a notification
Read it
Write a response
Switch apps
This background processing will prevent a message from not being sent due to moving quickly to the background.
Problem
When a user opens the chat app after a period of inactivity/activity/actions, the NetworkQueue is filled with a large queue of unsent requests. This queue causes significant processing delays, which result in app hangs and infinite loading of messages, preventing users from having a seamless messaging experience.
Solution
To address this problem, consider implementing background task processing that allows the app to handle network requests even when not actively open. For mobile (Android/iOS), you could utilize:
For Android: Use WorkManager to manage background tasks reliably. For iOS: Implement Background Fetch to periodically process network requests. For both: Consider using React Native Background Fetch or https://reactnative.dev/docs/headless-js-android
Additional Solutions for Web and Desktop
Web: Leverage Service Workers for handling background sync when internet connection is re-established. Desktop: Use Electron’s background task handling capabilities (e.g., electron-ipc).
Cases:
User is offline or in a poor network connection
User takes some actions and serializes network requests
User puts app in the background
User regains network connection, requests from the queue start executing.
User opens the app and has no remaining network requests (or maybe a few)
Open the app from a notification
Read it
Write a response
Switch apps
This background processing will prevent a message from not being sent due to moving quickly to the background.
Slack Thread: https://expensify.slack.com/archives/C05LX9D6E07/p1727884875529299