Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Maybe it is too late to reply...</p> <p>Usual request time is about one minute, if "getMovie(m.getId());" request info from some other server it may take long and go through your minute. </p> <p>GAE task has more time to run jobs so better you use your cron to enqueue a new task and let appengine do your work in the background. </p> <pre><code>Task t = new Task(); t.setUrl(URL_SERVLET_TO_UPDATE_MOVIES); //submit task TaskReference tr = queue.add(t); </code></pre> <p>This servlet runs the job of updating movies. </p> <p>Even needing more time (lets assume you got plenty of movies there) you can get only a few number of movies per query, actualize them, get a Cursor (works as range) and enqueue a new task with that cursor as parameter to the servlet. This new task will start from the next movie you have to actualize (thanks to the Cursor) and you will have full time to do your job. You can chain task until your job is done.</p> <p>At your servlet look for a cursor as param:</p> <pre><code>String encodedCursor = req.getParameter(CURSOR_PARAM); if ( encodedCursor != null){ oldCursor = Cursor.fromWebSafeString(encodedCursor); } </code></pre> <p>You can use this Cursor to query from the last movie you queried. Get a new cursor from the new query and add it as parameter to the new task.</p> <pre><code>Task t = new Task(); t.setUrl(PROCESSOR_SERVLET); //add cursor as parameter t.addParameter(CURSOR_PARAM, cursor.toWebSafeString()); //submit task TaskReference tr = queue.add(t); </code></pre> <p>Using Task and cursors you will get your job done in the background avoiding time limits. Of course, there are quotas over there...</p> <p>Doc about cursors: <a href="https://developers.google.com/appengine/docs/java/datastore/queries#Query_Cursors" rel="nofollow">https://developers.google.com/appengine/docs/java/datastore/queries#Query_Cursors</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload