Fix performance issue when it's not on focus #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a setInterval to check the notifications. The thing is that V8 will reduce the resource usage when the DOM is not on focus, but it will add the interval executions pending to a queue.
When you focus the app again, it will try to clear the queue, since the logic in that interval is "heavy" it will result in a heavy process load for quite a while.
This quick fix replace the
setInterval
by another in use DOM listener that already check the notifications and then uses a lightweight check to execute the notification.I've being using this for half a day and even in development mode the performance is way better than production mode.
I really recommend the code merge. :)