Within my application, the $digest cycle typically takes around 5ms to complete. I heavily utilize $q.defer with deferred.notify throughout my codebase, but I've encountered an issue. Each time deferred.notify is triggered, it schedules a new digest cycle, causing Angular to run for another 5ms.
This problem becomes apparent when retrieving thousands of rows of data from a server via WebSocket, where each piece of data is received individually. During this process, the app may max out CPU usage and become unresponsive, despite only saving the data into IndexedDB afterwards.
Is there a way to leverage $q and notify without triggering a new $digest cycle?
I've considered using a different promise implementation specifically for WebSocket and IndexedDB operations, but I'm hesitant due to the complexities it introduces in managing two different promise types within the same application.