cleroux opened a new pull request #732: Monitor 2.0: Eliminate use of 
async:false for ajax requests
URL: https://github.com/apache/accumulo/pull/732
 
 
   Forcing ajax queries to be synchronous isn't advisable for the reasons 
described in the links below.  I've improved the code to work asynchronously.
   I'm also working on some other improvements but I wanted to submit them as 
smaller PR's to make them easier to review.
   
   [jQuery.ajax(): Setting async to false is strongly discouraged as it can 
cause the browser to become unresponsive.](http://api.jquery.com/jquery.ajax/)
   [MDN: Synchronous requests on the main thread have been deprecated due to 
the negative effects to the user 
experience.](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Synchronous_and_Asynchronous_Requests#Synchronous_request)
   
   The functions that use .getJSON() in functions.js now return the jqXHR 
(jQuery XML HTTP Request) object.
   This object implements the Promise interface, so it's possible to provide a 
callback for when one or more requests complete.
   
   In most cases there was only one request to wait for so .then(handler) can 
be chained directly onto the request.
   
   In some cases, there were several requests issued synchronously.
   Where possible, the individual handlers were chained onto their respective 
request function if there were no dependencies between the requests.  (Eg. 
problems.js)
   
   The overview page is the only case where many requests must all be completed 
before the plots can be updated.  In this case $.always() is used to wait for 
all requests to finish.  Using $.always() will ignore any failures and continue 
to update the plots.  This isn't a great solution but there are no adverse 
effects and I intend to improve it further in another pull request.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to