Closed Looooopy closed 6 years ago
At the same time, we only have one timer, because if the message is sending, the function send does nothing: https://github.com/kutuluk/loglevel-plugin-remote/blob/master/src/remote.js#L163-L165
In addition, XMLHttpRequest.open is run in asynchronous mode (the third parameter is true), so it does not affect the UI either.
P.S. I apologize for Google translation.
Yes you are right. In the event that the server down, we get an infinite loop send->onreadystatechange->send->...
But the #4 has to solve this problem.
Good, and thanks :)
I will have a look at this on Monday to see if every thing works with our solution.
Works on my setup!
Thanks for your feedback!
Each time something is pushed on the queue we start a new timer so when server is down we get a timer for each message that is pushed and it can be a lot of timers that runs when the server is offline making the client GUI non responsive.
After push we call send() https://github.com/kutuluk/loglevel-plugin-remote/blob/master/src/remote.js#L252
When in the send()-->onreadystatechange we call setTimeout() https://github.com/kutuluk/loglevel-plugin-remote/blob/master/src/remote.js#L199
So if we push message and the server is down and then push another message we will have two timers that process the queue. So this will make the client get slower and slower until you run out of memory because you have to many timers that are running.
We should probably have a single processing loop or something more cleaver.
What do you think?