Greg.Veres
13 Mar 2011, 1:35 PM
This is really easy to duplicate. Create a store that is restful and hooked up to your server. Set the store to autosave=true
* set a break point in your server's POST handler
* add a new element to the store
* observe that it sends a POST to your server
* now update another element in your store
* observe that it sends a PUT for the change and a POST for the previous add.
* now let your server run and you will indeed see that the POST happens twice and your poor server will likely add the element twice because the server is responsible for creating the record ID.
So when this happens we see that for these two changes to the store, it sends these three messages to the server:
POST
POST
PUT
This has really bad consequences on the server. We found this when using our application of a WAN link so the response time of the server was slower than the user clicking on another UI element that updated the store. This is super easy to reproduce.
I would have expected the store to know that it already sent the POST and that the POST has not yet timed out.
Greg
* set a break point in your server's POST handler
* add a new element to the store
* observe that it sends a POST to your server
* now update another element in your store
* observe that it sends a PUT for the change and a POST for the previous add.
* now let your server run and you will indeed see that the POST happens twice and your poor server will likely add the element twice because the server is responsible for creating the record ID.
So when this happens we see that for these two changes to the store, it sends these three messages to the server:
POST
POST
PUT
This has really bad consequences on the server. We found this when using our application of a WAN link so the response time of the server was slower than the user clicking on another UI element that updated the store. This is super easy to reproduce.
I would have expected the store to know that it already sent the POST and that the POST has not yet timed out.
Greg