views:

218

answers:

1

I am developing an Twitter4J web application in Google App Engine/Java.

I need to show two lists. One is Twitter friends and other is followers. With photo and screen name.

It is working fine for people who have 20-30 followers and friends. But it gave me DeadlineExceededException when I try a user who has 150+ followers and friends.

GAE throws this exception if web request take time more than 30 seconds.

So what techniques I can adopt to avoid this exception.

Should I generate two AJAX calls for each of my list. After page loads. So that every call will have its own 30 secs limit?

Or what else you think? I am gone make it.

Please help.

+1  A: 

Not sure if you intend to query all followers/friends at once (it would be a problem with the Twitter api rate limit for people with a very large number of followers/friends anyway). So I assume you query the Twitter api for a limited number of followers/friends, and using the Twitter paging to get more as needed to show.

My solution would be, and it also something I've implemented for Twitter, is to do the statuses/friends and statuses/followers from the browser. This is possible via JavaScript by adding a html <script> tag with the status url and the callback function in the browser. This bypasses GAE as proxy. This not only avoids the timeout problem on GAE it also reduces the number of calls/cpu-time in GAE, which means it will be cheaper if your applications scales up, above the free GAE limit.

Hilbrand
Thanks Hilbrand for your response. I think you are talking about sending tweet. Right? So if I compose a URL, that tweet text will appear on Twitter web's text area. And my site will not be mentioned as <Tweet via this.com>. If I understand you correctly.
Tahir Akram
No, I'm referring to calling timeline's. This is done via the callback method, see http://apiwiki.twitter.com/Things-Every-Developer-Should-Know#5Parametershavecertainexpectations. Posting must be done through a proxy (GAE in your case), because cross domain restrictions from within the browser. When posting via the Twitter api, they show up with you application name.
Hilbrand