openfaas / nats-queue-worker

Queue-worker for OpenFaaS with NATS Streaming
https://docs.openfaas.com/reference/async/
MIT License
129 stars 59 forks source link

Set X-Duration-Seconds header on timeout #78

Closed ewilde closed 4 years ago

ewilde commented 4 years ago

Set X-Duration-Seconds header when original function call exceeds timeout.

Fixes #77

Signed-off-by: Edward Wilde ewilde@gmail.com

Description

Motivation and Context

How Has This Been Tested?

Tested on Mac OS with docker swarm

  1. Created function a with that sleeps longer than timeout
  2. Created callback function that prints X-Duration-Seconds header

Before change

Logs from callback function

2019/12/09 02:56:41 stderr: 2019/12/09 02:56:41 Status:[502], time:[], body:

After change

Logs from callback function

2019/12/09 03:23:20 Status:[502], time:[10.024013], body:

Types of changes

Checklist:

alexellis commented 4 years ago

Thanks

FYI https://github.com/openfaas/nats-queue-worker/releases/tag/0.9.0