# Een timer instellen in het verleden lijkt niet te werken, maar dat doet het wel

**URL:** https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252
**Category:** Bug
**Created:** [26 oktober 2020 om 07:28 UTC](https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252 "2020-10-26T07:28:57Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Nacho\_Caballero](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nacho_caballero/32/130189_2.png) [@Nacho\_Caballero](https://meta.discourse.org/u/Nacho_Caballero)
#### Post date: [26 oktober 2020 om 07:28 UTC](https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252/1 "2020-10-26T07:28:57Z")

</div>

I often use the `POST /t/:topic_id/timer` action to change topic categories (from private to public).

This works fine if the `time` parameter is in the future, but if I use the current time (or a past time by mistake), I get a valid response but the category change does not happen instantaneously.

It usually takes 5-10 minutes, which can be confusing (I’m assuming this is due to the frequency of an internal polling loop).

Here is an example request (past time) and response:

```plaintext
# Request
POST /t/4378/timer HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Api-Key: REDACTED
Api-Username: REDACTED
Connection: keep-alive
Content-Length: 96
Content-Type: application/json
Host: REDACTED
User-Agent: HTTPie/2.2.0

{
    "category_id": "54",
    "status_type": "publish_to_category",
    "time": "2020-10-26 08:09:45+01:00"
}

# Response
HTTP/1.1 200 OK
Cache-Control: no-cache, no-store
Connection: keep-alive
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Mon, 26 Oct 2020 07:09:46 GMT
Referrer-Policy: strict-origin-when-cross-origin
Server: nginx/1.18.0 (Ubuntu)
Strict-Transport-Security: max-age=63072000;
Transfer-Encoding: chunked
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Discourse-Route: topics/timer
X-Discourse-Username: REDACTED
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: REDACTED
X-Runtime: 0.055819
X-XSS-Protection: 1; mode=block

{
    "based_on_last_post": false,
    "category_id": 54,
    "closed": false,
    "duration": null,
    "execute_at": "2020-10-26T07:09:45.000Z",
    "success": "OK"
}

```

**Update** : I thought this was exclusive to the API, but it can also be a problem in the UI because even though you can’t select a date in the past, you can select a time in the past.

 ![image](https://global.discourse-cdn.com/meta/original/3X/d/0/d0501cf9c9f1d2200ee5554db4073afd1c7f5846.png)

The behavior is the same: no indication that a timer has been set, but it still goes off anywhere between 5-10 minutes after being created.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [3 december 2020 om 19:49 UTC](https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252/2 "2020-12-03T19:49:02Z")

</div>

This is a bit of an edge case, but I think the server should return an error message if you submit a topic timer with today’s date and a time in the past.

---

<div class="post-metadata">

### Author: ![markvanlan](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markvanlan/32/160087_2.png) [@markvanlan](https://meta.discourse.org/u/markvanlan)
#### Post date: [8 december 2020 om 16:16 UTC](https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252/5 "2020-12-08T16:16:54Z")

</div>

There is in fact a 🐛 in the code that blocks past dating. PR is open:  
[https://github.com/discourse/discourse/pull/11434](https://github.com/discourse/discourse/pull/11434)

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [8 december 2020 om 18:48 UTC](https://meta.discourse.org/t/setting-a-timer-in-the-past-seems-to-not-work-but-it-does/168252/6 "2020-12-08T18:48:23Z")

</div>


