java - Google App Engine cron job sometimes fails due to too many retries -
i have google app engine cron job often, not always, fails because max retries java servlet has been reached. google app engine app works fine otherwise.
my servlet shown below, , reaches "too many retries" point, not always.
it scheduled run every few hours, , seems may failing due waiting instance of app startup, don't know sure.
how can fix this? increase number of retries? how can debug know causing "too many retries" reached?
public class someservlet extends baseservlet { private static final string header_queue_count = "x-appengine-taskretrycount"; ... @override protected void dopost(httpservletrequest req, httpservletresponse resp) throws ioexception { string retrycountheader = req.getheader(header_queue_count); if (retrycountheader != null) { int retrycount = integer.parseint(retrycountheader); if (retrycount > 10) { logger.severe("too many retries, dropping task..."); taskdone(resp); return; } } ... }
it fails because retrycount continues increment every time cron task executed. there no control on retries google app engine cron task. in example above, once 10 cron jobs have been performed, servlet reach "too many retries" point.
simply remove retrycount testing , enqueue real gae task in cron job if retry control necessary.
Comments
Post a Comment