Ernst Beiglböck
2007-Apr-28 17:44 UTC
How to prevent that sequence of requests get disorderd?
Hi all, sorry, my English is not so good, I hope you understand my question. I have a Form Observer, which calls an Ajax.Updater on any change in the form. Now I have the following problem: If you change two things very fast in the form, the second request sometimes gets answered first, and then the first, which then overwrites the update of the second. Let me illustrate it Chronological: Request1 is being sent Request2 is being sent Request2 is answered and site gets updated Request1 is answered and site gets updated with stale data How can I prevent this elegantly in Prototype? I have tried to give each request a consecutive id, but I don''t really know how to make this. Does anybody have a cool solution? Thanks very much! Greetings Ernst --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Ernst, I''ve had the same problem in the past.... ... I did this to solve it: http://yetanotheruser.blogspot.com/2007/02/prototype-update-stack.html .. .or perhaps this thread would be more useful: http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/6d2fcbb2167d801c This was basically to stop the earlier request coming in last and overwriting a later/faster request which had already come in.. ... it''s for the Ajax.Updater() but I''m sure we could re-purpose it for you to use with your code? Cheers, J. On 28 Apr, 18:44, Ernst Beiglböck <ernst.beiglbo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > sorry, my English is not so good, I hope you understand my question. > I have a Form Observer, which calls an Ajax.Updater on any change in > the form. > Now I have the following problem: If you change two things very fast > in the form, the second request sometimes gets answered first, and > then the first, which then overwrites the update of the second. > Let me illustrate it > Chronological: > Request1 is being sent > Request2 is being sent > Request2 is answered and site gets updated > Request1 is answered and site gets updated with stale data > > How can I prevent this elegantly in Prototype? I have tried to give > each request a consecutive id, but I don''t really know how to make > this. Does anybody have a cool solution? > Thanks very much! > Greetings > Ernst--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ernst Beiglböck
2007-Apr-29 18:35 UTC
Re: How to prevent that sequence of requests get disorderd?
Thanks so much. I just applied the patch from your website and added the option ''override:true'' to my Ajax.Updater calls! Thanks again, Bye On Apr 29, 12:12 pm, Jimbo <jimbomorri...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Ernst, > > I''ve had the same problem in the past.... > > ... I did this to solve it:http://yetanotheruser.blogspot.com/2007/02/prototype-update-stack.html > > .. .or perhaps this thread would be more useful:http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thr... > > This was basically to stop the earlier request coming in last and > overwriting a later/faster request which had already come in.. > > ... it''s for the Ajax.Updater() but I''m sure we could re-purpose it > for you to use with your code? > > Cheers, > J. > > On 28 Apr, 18:44, Ernst Beiglböck <ernst.beiglbo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi all, > > sorry, my English is not so good, I hope you understand my question. > > I have a Form Observer, which calls an Ajax.Updater on any change in > > the form. > > Now I have the following problem: If you change two things very fast > > in the form, the second request sometimes gets answered first, and > > then the first, which then overwrites the update of the second. > > Let me illustrate it > > Chronological: > > Request1 is being sent > > Request2 is being sent > > Request2 is answered and site gets updated > > Request1 is answered and site gets updated with stale data > > > How can I prevent this elegantly in Prototype? I have tried to give > > each request a consecutive id, but I don''t really know how to make > > this. Does anybody have a cool solution? > > Thanks very much! > > Greetings > > Ernst--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---