PDA

View Full Version : Add timeout to Provider Actions



ckr
18 Jun 2009, 6:45 PM
It would be nice to be able to set a unique timeout value for each provider actions. Sometimes there might be a delay from the server side due to a lengthy process. Other times you might want to generate an exception if the return is not fast enough.

I have used Ext.Ajax.timeout (http://extjs.com/deploy/ext-3.0-rc2/docs/?class=Ext.Ajax&member=timeout) to get around things, but I think it would be better to have the ability to set this per provider actions rather than changing Ext.Ajax.timeout.

Thoughts? :-/

evant
27 Sep 2009, 11:04 PM
A timeout parameter has since been added to the provider itself.

I like the idea of having a timeout on specific actions, however you will encounter a problem when using buffering.

Let's say I've specified a timeout on A of 5s and a timeout of 6s on B.

What happens when I queue A & B within a buffered transaction?

In that case the only way you could get around that is to send seperate requests for action groups, which isn't really desireable and kind of defeats the purpose of buffering in the first place.

What do people think?

J@y
28 Sep 2009, 9:10 AM
Just give an example for ppls to think about it:

In one of my panel, it contains several portlets (panel), each panel owns a dataview and store. That means 10 panels will make 10 AJAX requests to the server.

I'd want to separate these 10 requests into 2 groups, as a result each group has 5 requests.

Why I'm doing that?
If I make 10 requests into 1 batch (by setting the buffer size of remotingProvider), all the portlet's results will be held until all 10 requests got the response from server.

However, I don't want to set the buffersize to 0, which means 10 request will consume 10 individual AJAX requests. It waste a lot of bandwidth (the http header part).

So this is our scenario.

And till now I can't find a way to do that...

evant
28 Sep 2009, 4:11 PM
I think you're mistaking the purpose of the buffer.

The buffer is the amount of ms to wait before sending off a series of requests, not the number of requests to send.

The purpose of the timeout parameter is to indicate how long to wait before the request succeeds/fails.

J@y
28 Sep 2009, 7:53 PM
I think you're mistaking the purpose of the buffer.

The buffer is the amount of ms to wait before sending off a series of requests, not the number of requests to send.

The purpose of the timeout parameter is to indicate how long to wait before the request succeeds/fails.


I understand what the buffer doing, my problem is I cannot manually group the requests.

Since I can't control the ms of each request to be sent out, how do I manage or give them a priority?

Anyway, please suggest some solutions to solve my case, if possible.
thanks

evant
28 Sep 2009, 8:11 PM
How do you want to group them? What kind of logic would you use? if the buffer is defaulting to 10ms, does it really matter?

Would you want to be able to group all requests by action?

J@y
28 Sep 2009, 9:01 PM
As mentioned above:


In one of my panel, it contains several portlets (panel), each panel owns a dataview and store. That means 10 panels will make 10 AJAX requests to the server.

I'd want to separate these 10 requests into 2 groups, as a result each group has 5 requests.

Why I'm doing that?
If I make 10 requests into 1 batch (by setting the buffer size of remotingProvider), all the portlet's results will be held until all 10 requests got the response from server.

However, I don't want to set the buffersize to 0, which means 10 request will consume 10 individual AJAX requests. It waste a lot of bandwidth (the http header part).

So this is our scenario.

evant
28 Sep 2009, 10:17 PM
Yes, I understand, but practically, how would it work?

What is your criteria for grouping? When you send off the call, how do you specify it should be part of a particular group? Or how do you indicate to the provider that a particular action should belong to that group?

J@y
29 Sep 2009, 1:40 AM
Yes, I understand, but practically, how would it work?

What is your criteria for grouping? When you send off the call, how do you specify it should be part of a particular group? Or how do you indicate to the provider that a particular action should belong to that group?

Basically, you can imagine that a Panel on a page, with left and right region.

For each region, it contains 5 portlets (let say they are gridpanel).

So, in order to separate the loading dependency of 2 regions, while we don't want to make 10 individual requests.

As a result we decided to group 10 requests into 2 separate groups.

evant
29 Sep 2009, 7:04 AM
Then, perhaps the solution is a "batchgroup" option we could add, which would allow you to specify different buffers/timeouts for different groups.

ckr
29 Sep 2009, 8:36 AM
I like the idea of creating a batch group. I could see that being useful with various forms, etc.

But for me, I simply have some long running processes that really are not logically related other than they take a bit longer for the server to process. Since there is now a timeout for the Provider, I could group these by Provider. Not ideal, but better than setting Ext.Ajax.Timeout every time. I will test when the release is available (no SVN access).

Having the ability to set a timeout per action (if needed, otherwise take the default) would be best.

Thanks Evant for looking at this (I had almost forgotten about this post).

J@y
29 Sep 2009, 8:37 AM
Then, perhaps the solution is a "batchgroup" option we could add, which would allow you to specify different buffers/timeouts for different groups.

Yea! thats exactly what I want!

Actually when the app becomes bigger and bigger, it's hard to manage the ajax requests within a page, especially for those informational web portal.

Hope Extjs will do the miracle in next version :D

ThorstenSuckow
7 Oct 2009, 8:38 AM
A config-batchgroup sounds reasonable to me. However, it would be nice to have the timeout option - and an option, if the timeouts for a batch should get stacked or not. If that won't happen, a few more events would be nice, such as "beforebatch", "batch" etc which gives us complete access to the batched actions and the request object, so we can set up the timeout for ourself.

Bookmarking this thread...

Dumbledore
15 Jan 2011, 12:06 AM
Hi,

is there something like a "batchgroup" in the current release of ExtJS?

Bye, Dumbledore