ParseRequestHeaders parses the special HTTP request headers available to push task request handlers. This function silently ignores values of the wrong format.
(h http.Header)
| 168 | // task request handlers. This function silently ignores values of the wrong |
| 169 | // format. |
| 170 | func ParseRequestHeaders(h http.Header) *RequestHeaders { |
| 171 | ret := &RequestHeaders{ |
| 172 | QueueName: h.Get("X-AppEngine-QueueName"), |
| 173 | TaskName: h.Get("X-AppEngine-TaskName"), |
| 174 | } |
| 175 | |
| 176 | ret.TaskRetryCount, _ = strconv.ParseInt(h.Get("X-AppEngine-TaskRetryCount"), 10, 64) |
| 177 | ret.TaskExecutionCount, _ = strconv.ParseInt(h.Get("X-AppEngine-TaskExecutionCount"), 10, 64) |
| 178 | |
| 179 | etaSecs, _ := strconv.ParseInt(h.Get("X-AppEngine-TaskETA"), 10, 64) |
| 180 | if etaSecs != 0 { |
| 181 | ret.TaskETA = time.Unix(etaSecs, 0) |
| 182 | } |
| 183 | |
| 184 | ret.TaskPreviousResponse, _ = strconv.Atoi(h.Get("X-AppEngine-TaskPreviousResponse")) |
| 185 | ret.TaskRetryReason = h.Get("X-AppEngine-TaskRetryReason") |
| 186 | if h.Get("X-AppEngine-FailFast") != "" { |
| 187 | ret.FailFast = true |
| 188 | } |
| 189 | |
| 190 | return ret |
| 191 | } |
| 192 | |
| 193 | var ( |
| 194 | currentNamespace = http.CanonicalHeaderKey("X-AppEngine-Current-Namespace") |
searching dependent graphs…