Question: I'd like to add a task on the App Engine Task Queue, but only if it hasn't been enqueued before. How can I check whether its already in queue or not? Wasn't obvious from the task queue API, but maybe I missed it. They key to the task (param?) would be user\_id.
Use case: I keep checking for new messages every minute. This needs to happen very frequently. However, sometimes there are other jobs in this queue (they all need to be part of the same queue because they are using an external service, Gmail API, which has a rate limit of 10 qps, which I can only guarantee by rate limiting the queue). When these heavy processes run, they backlog the queue. To avoid this, I'd like to check whether a incremental-fetch task has previously been enqueued, and only enqueue if it hasn't. What is the best practice to achieve something like this?

Answer: 
You can use [task names](https://cloud.google.com/appengine/docs/java/taskqueue/#Java_Task_names) for this purpose.
I would add a [tag to the task](https://cloud.google.com/appengine/docs/python/taskqueue/tasks#Task_tag) then do a [lease\_task\_by\_tag](https://cloud.google.com/appengine/docs/python/taskqueue/queues#Queue_lease_tasks_by_tag) with a lease\_seconds set to 0. If its empty then I can safely create a new one.