View Full Version : timeout but no timeout?
Brigitta
09-07-2007, 04:24 AM
Hi,
sometimes when I do a couple of dataset requests in fast succession I get ontimeout events after a couple of milliseconds. But I get the data as well.
Why do I get the ontimeout? Isn't it supposed to come when there is no data after 30 seconds?
I use laszlo 4.0.3 / flash7/8 / ff2/ie6
Regards
Brigitta
Brigitta
09-13-2007, 01:55 AM
Anybody got an idea?
senshi
09-13-2007, 11:52 AM
Do you have any reproducible testcase for this phenomenon?
This simple test passes without any warnings:
<canvas debug="true" >
<dataset name="ds" src="dataset_timeout.xml" type="http" request="false" />
<handler name="ondata" reference="ds" >
//Debug.write("ondata at %d", (new Date()).getTime());
</handler>
<handler name="ontimeout" reference="ds" >
Debug.info("ontimeout at %d", (new Date()).getTime());
</handler>
<handler name="onerror" reference="ds" >
Debug.info("onerror at %d", (new Date()).getTime());
</handler>
<attribute name="requestdelay" value="500" type="number" />
<handler name="oninit" >
this.requestDel = new LzDelegate(this, "requestData");
LzTimer.addTimer(this.requestDel, this.requestdelay);
</handler>
<method name="requestData" >
this.ds.doRequest();
LzTimer.addTimer(this.requestDel, this.requestdelay);
</method>
</canvas>
Brigitta
09-16-2007, 01:42 AM
Hi senshi,
unfortunately I do not have a simple testcase at the moment. It is reproducable, but it is embedded in my application. I will try to separate it.
But I found out something more. It happens when I unintentionally call doRequest on the same dataset twice. For example I use an edittext to select to which page the user would like to go, and I used onblur AND onkeydown to execute the request. So sometimes it was called twice. And within milliseconds I got a timeout AND a correct result. So it does not have anything to do with different datasets called one after the other but with multiple requests on the same dataset.
As I know the reason now I can prevent it but nevertheless I do not think, that the ontimeout should have fired.
Edit: I tried your testcase. If you set the requestdelay to 10 you get the effect. So it probably means that the request cannot be started.
Regards
Brigitta
senshi
09-18-2007, 01:39 PM
I'm using the current development branch and with this one I couldn't reproduce the issue with getting "ontimeout"-Events, but what I got were "onerror"-Events. So apparently somebody switched the event from "ontimeout" to "onerror"...
But nevertheless, you're right you get these "ontimeout" / "onerror" events when you're requesting a still loading dataset. So what you need to do is to avoid requesting a dataset which is not fully loaded resp. simply calling "abort()" on your dataset as belt-and-suspenders.
Brigitta
09-20-2007, 08:47 PM
Since I do not know how to prevent a user hitting the next button while the datasets are loaded I tried to call abort before doRequest but unfortunately it does not change a thing.
senshi
09-22-2007, 03:12 AM
You can disable the button and re-enable it after you've received data from your backend. Or you use a wrapper-method/-class which handles requests and provides a mechanism either to ignore or to enqueue requests, so you can assure you won't call "doRequest" for a still loading dataset.
However, as I'm using the current development branch, I've got access to the new Dataprovider (http://wiki.openlaszlo.org/Dataprovider) classes, but I think they're also shipped with the newly shipped OL4.0.5, so you should also be able to use things like this to check the dataset status:
<method name="requestData" >
if (this.ds.dataRequest.status != "loading") {
this.ds.doRequest();
}
LzTimer.addTimer(this.requestDel, this.requestdelay);
</method>
Brigitta
09-28-2007, 01:38 AM
Hi senshi,
thanks a lot for your tipps. I switched to the new version but unfortunately status is always undefined, so that did not help much.
Now I use a counter which I increment in the ondata event of the dependent datasets and I only start a new request if all datasets are loaded. That works fine.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.