Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google App Engine: Determine whether Current Request is a Taskqueue

Is there a way to dynamically determine whether the currently executing task is a standard http request or a TaskQueue?

In some parts of my request handler, I make a few urlfetches. I would like the timeout delay of the url fetch to be short if the request is a standard http request and long if it is a TaskQueue.

like image 581
speedplane Avatar asked Jan 17 '23 09:01

speedplane


1 Answers

Pick any one of the following HTTP headers:

  1. X-AppEngine-QueueName, the name of the queue (possibly default)
  2. X-AppEngine-TaskName, the name of the task, or a system-generated unique ID if no name was specified
  3. X-AppEngine-TaskRetryCount, the number of times this task has been retried; for the first attempt, this value is 0
  4. X-AppEngine-TaskETA, the target execution time of the task, specified in microseconds since January 1st 1970.

Standard HTTP requests won't have these headers.

like image 123
Eric Willigers Avatar answered Jan 19 '23 00:01

Eric Willigers