Mechanism to Abstract Over Retried AJAX Calls
When the browser makes an AJAX call (form submission, button press, etc) in a high latency situation, it is entirely possible that the request may timeout and the browser will have to retry. This is handled in the browser by handling failure on the jQuery AJAX request. Unfortunately, the server-side component of Lift's AJAX has no awareness of the retry mechanism. As such, a retry can potentially lead to repeated invocations of the AJAX handler function. Considering that the retry mechanism itself is something handled internally by Lift, I would expect that the application layer would be completely shielded from any associated semantic effects.
I propose that every AJAX request should get a once-use identifier. Retries would use the same id as the original, but all other requests would get a unique id. This would allow the server to differentiate repeated AJAX requests from retries, giving it the ability to ensure that AJAX handler functions are only invoked once per request.
See discussion here: http://groups.google.com/group/liftweb/browse_thread/thread/5b8d430dcea70776
I propose that every AJAX request should get a once-use identifier. Retries would use the same id as the original, but all other requests would get a unique id. This would allow the server to differentiate repeated AJAX requests from retries, giving it the ability to ensure that AJAX handler functions are only invoked once per request.
See discussion here: http://groups.google.com/group/liftweb/browse_thread/thread/5b8d430dcea70776
Leave a comment
on 2010-05-15 11:21 *
By marius.danciu
on review board.
on 2010-05-21 10:19 *
By marius.danciu
Assigned to changed from dpp to marius.danciu
Status changed from New to Accepted
The fix is on review board waiting approvals.
(In revision:6dfe055b8c9272689a8fef6fb119e9b0f30a3062) Closes #437. Adds a one-shot capability to function creation (works in standard http, ajax, etc.) such that a function (that may have side effects) will only be fired once. Updated TestKit to write some tests
Branch: master
Branch: master