# Task timeout not considered for offline devices

**URL:** <https://forum.genieacs.com/t/task-timeout-not-considered-for-offline-devices/2436>\
**Category:** Uncategorized\
**Created:** [February 18, 2022, 9:57am UTC](https://forum.genieacs.com/t/task-timeout-not-considered-for-offline-devices/2436 "2022-02-18T09:57:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![olebowle](https://avatars.discourse-cdn.com/v4/letter/o/bcef8e/32.png) [@olebowle](https://forum.genieacs.com/u/olebowle)\
**Post date:** [February 18, 2022, 9:57am UTC](https://forum.genieacs.com/t/task-timeout-not-considered-for-offline-devices/2436/1 "2022-02-18T09:57:21Z")

</div>

Hi,

it seems when issuing tasks (e.g. rebooting a CPE) for offline devices, the timeout parameter along the connection\_request parameter is not considered. It seems the call always blocks for ~2 seconds.

Connection request with no timeout:

```auto
$ time curl -i 'http://localhost:7557/devices/00040E-FRITZ%2521Box-2C91ABD32E93/tasks?connection_request' -X POST --data '{ "name": "reboot" }'
HTTP/1.1 202 Device is offline
GenieACS-Version: 1.2.8+20211027200938
Content-Type: application/json
Date: Wed, 16 Feb 2022 14:04:16 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked

{"name":"reboot","device":"00040E-FRITZ%21Box-2C91ABD32E93","timestamp":"2022-02-16T14:04:14.786Z","_id":"620d045e88cdb4c6f6dfc8b1"}
real 0m2.063s
user 0m0.004s
sys 0m0.003s

```

Connection request with 5 second timeout:

```auto
$ time curl -i 'http://localhost:7557/devices/00040E-FRITZ%2521Box-2C91ABD32E93/tasks?connection_request&timeout=5000' -X POST --data '{ "name": "reboot" }'
HTTP/1.1 202 Device is offline
GenieACS-Version: 1.2.8+20211027200938
Content-Type: application/json
Date: Wed, 16 Feb 2022 14:04:38 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked

{"name":"reboot","device":"00040E-FRITZ%21Box-2C91ABD32E93","timestamp":"2022-02-16T14:04:36.474Z","_id":"620d04748701404bab706973"}
real 0m2.070s
user 0m0.001s
sys 0m0.005s

```

Connection request with 1 milisecond timeout:

```auto
$ time curl -i 'http://localhost:7557/devices/00040E-FRITZ%2521Box-2C91ABD32E93/tasks?connection_request&timeout=1' -X POST --data '{ "name": "reboot" }'
HTTP/1.1 202 Device is offline
GenieACS-Version: 1.2.8+20211027200938
Content-Type: application/json
Date: Wed, 16 Feb 2022 14:04:31 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Transfer-Encoding: chunked

{"name":"reboot","device":"00040E-FRITZ%21Box-2C91ABD32E93","timestamp":"2022-02-16T14:04:29.243Z","_id":"620d046d6c4621eece4ef287"}
real 0m2.069s
user 0m0.001s
sys 0m0.005s

```

As one can see the API always blocks for ~2 seconds irrespective of the timeout parameter for an offline device.
