Peter Farmer
Peter Farmer

Reputation: 9390

Task queue execution

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?

Upvotes: 2

Views: 535

Answers (2)

Wooble
Wooble

Reputation: 90037

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.

Upvotes: 3

Adam Crossland
Adam Crossland

Reputation: 14213

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

Upvotes: 2

Related Questions