2

I'm developing a site for a customer which regularly sends email notifications, to facilitate this I have a cron job which runs at 2am to start scheduling individual tasks to send out the notications. This is all fine and work perfectly with tasks being scheduled to execute immediately, but to assist development and testing I've written some CLI apps which use ipython and the remote_api_stub to interact with my application and datastore, when I schedule tasks on the command line like this:

task = taskqueue.Task(url='/admin/tasks/email', params={'email': email, 'type': notif.type})
task.add("email")

I get a 1 hour delay on the task execution. Why is this? and is there a way to get the task to execute immediately?

2 Answers 2

3

There seems to be a timezone-related bug in the SDK that causes the eta for tasks created through the remote API to be scheduled one hour after they're added. If you explicitly set the countdown to 0, the task should be scheduled to run immediately.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks but using task = taskqueue.Task(url='/admin/tasks/email', params={'email': email, 'type': notif.type}, countdown=0) still schedules in 1 hour :/
Try setting the ETA to the past, instead.
2

If you want it to execute immediately, just open the URL in a browser. Why muck around with Task queues?

2 Comments

Thanks, but tasks are called with POST not GET, so not really a solution.
But a Task is just a URL that is handled by a RequestHandler in your application, and you can easily make it run the same code regardless of whether it is called with GET or POST.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.