cancel
Showing results for 
Search instead for 
Did you mean: 

YUI ajax request timeout override(share/proxy/alfresco call)

zladuric
Champ on-the-rise
Champ on-the-rise
Hi,

I'm developing a Share dashlet which waits for user to fill in the form and then emails a lot of other users. Now, I'm doing the emailing part via a webscript, and I'm trying to get this webscript to work through an Ajax call. There are a lot of users in this group and the mail server isn't the fastest in the world (shared hosting server) So the mailing takes a bit, about 2-3 minutes.


            Alfresco.util.Ajax.request({
               url: url,
               method: "GET",
               responseContentType: JSON,
               timeout:null, // tried varying this in many ways
               successCallback: {
                  fn:this.mailSent,
                  scope: this
               },
               successMessage: "Sent",
               failureCallback: "Failed sending"
            });    
Now, my problem is that the requests always timeout at 90 seconds.

The webscript completes its task, but I cannot get a result on the Share side and show it to the user. The script still finishes the job, but I don't get info. Tried different browsers. Tried setting the timeout to more and to null and avoid it completely.

Now, an interesting point, I tried calling directly in the browser:
http://192.168.254.21:8888/alfresco/service/pbk/mail-announcement?id=200859

This worked!
But via proxy:
http://192.168.254.21:8888/share/proxy/alfresco/pbk/mail-announcement?id=200857
it timeouts (ie. empty response after exactly 90 seconds).

Can somebody tell me what setting should I look for/change?  How can I do this differently?
6 REPLIES 6

zladuric
Champ on-the-rise
Champ on-the-rise
For what it's worth (and for future unhappy user stumbling on this thread, I've found out where this timeout is set.

It's hardcoded in RemoteClient class in spring webscripts framework (/org/springframework/extensions/webscripts/connector/RemoteClient.java):
    private static final int CONNECT_TIMEOUT = 5000;  // 5 seconds
    private static final int READ_TIMEOUT = 180000;    // 90 seconds

Hopefully somebody else won't stumble on this too.

ddraper
World-Class Innovator
World-Class Innovator
This issue has been raised in JIRA (https://issues.alfresco.com/jira/browse/ALF-10737). Hopefully we'll get the opportunity to make this update… although as it's technically an improvement rather than a bug it's not on our immediate priority list unfortunately.

Regards,
Dave

zladuric
Champ on-the-rise
Champ on-the-rise
Yes, thanks for the link. I forgot to include it. (Well, not forgot, the thought that I should didn't even cross my slow mind Smiley Happy ).

ddraper
World-Class Innovator
World-Class Innovator
In case you've not seen it… that issue (https://issues.alfresco.com/jira/browse/ALF-10737) and committed to the Alfresco community source code.  It's now possible to configure the timeout on the RemoteClient via it's Spring bean configuration - both the linked issue and the configuration file contain information on how to do this.

Regards,
Dave

zladuric
Champ on-the-rise
Champ on-the-rise
Yes, I know. But we're on 3.4 version with no immediate plans for upgrade. And the comments in that issue only says that it "could" be backported to 3.4.x.

Thanks any way.

kevinr
Star Contributor
Star Contributor
I'm sure we'll be able to back port that to the next open 3.4.X bug fix codeline which is 3.4.8.

Thanks,

Kev