My app is essentially a specialized reminder tool.  it has a cron job
that wakes up every 15 minutes to see if anybody needs to be nagged
(sent an email reminder).

The cron job does a query against one entity looking for anything with
a UTC time equal or before "now".  The query looks like:

"select from " + ActionItem.class.getName()
                                + " where actionTime <= " + (hourOfDay);

With that result we simply queue a task to process the actual action
(which may be to send email).  But that's all there is to it: read a
result set and enqueue something for each item returned.

This request about 1/3 of the time blows up with the dreaded "Request
was aborted after waiting too long to attempt to service your
request."  Right now that is somewhat OK because the request will run
again in 15 minutes and therefore eventually pick up the work that the
failed requests miss.

I *thought* that I was hitting a resource limit so my first attempt to
work around this was to wrap my read loop in a try/catch looking for
the exceptions:

}catch(com.google.apphosting.api.ApiProxy.OverQuotaException oq){
                        log.info("over quota! trying again");
                        String stampStr = ""+gCal.getTimeInMillis();
                        String urlStr ="/setup?hour="+stampStr+"L";
                        TaskOptions url = TaskOptions.Builder.url(urlStr);
                        queue.add(url.method(Method.GET));
                }catch(com.google.apphosting.api.DeadlineExceededException de){
                        log.info("out of time! trying again");
                        String stampStr = ""+gCal.getTimeInMillis();
                        String urlStr ="/setup?hour="+stampStr+"L";
                        TaskOptions url = TaskOptions.Builder.url(urlStr);
                        queue.add(url.method(Method.GET));

And then stopping and re-queuing the task.  However empirically I
don't seem to ever catch these exceptions.  My request just gets
aborted with no warning (and apparently no log output)

I am afraid that this problem will grow as the app grows so I am
looking for ideas to fix it.  Two approaches seem to be worth trying:

1) Cache the query results somehow to avoid need to run it if
possible.

2) Use low level data store API to run the query so that I can
(possibly) complete a partial read of the reminder data.

(question, also I am doing something wrong here? -- It seems like a
simple query should be able to at least partially complete in the time
it takes to do one request - given that I am the only one using my dev
version of the app.)

I am hoping someone can tell me which of these ideas is more likely to
help (or give me an alternate idea)

Thanks.


-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to