# Extend TimerProvider

**URL:** <https://forum.keycloak.org/t/extend-timerprovider/12096>\
**Category:** Extending the server\
**Created:** [November 15, 2021, 3:05pm UTC](https://forum.keycloak.org/t/extend-timerprovider/12096 "2021-11-15T15:05:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jumpingElephant](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jumpingelephant/32/3538_2.png) [@jumpingElephant](https://forum.keycloak.org/u/jumpingElephant)\
**Post date:** [November 15, 2021, 3:05pm UTC](https://forum.keycloak.org/t/extend-timerprovider/12096/1 "2021-11-15T15:05:36Z")

</div>

In Keycloak there is this SPI TimerProvider available. In its implementation BasicTimerProvider I found, that the interval parameter is not only used as interval, but also as delay time for the first task run.  
I would like to specify an alternative value for the delay and avoid implementing the whole SPI myself. Is there an easy way to modify this beahvior?

---

<div class="post-metadata">

**Author:** ![lucas-fbastos](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/lucas-fbastos/32/4460_2.png) [@lucas-fbastos](https://forum.keycloak.org/u/lucas-fbastos)\
**Post date:** [November 23, 2021, 8:02pm UTC](https://forum.keycloak.org/t/extend-timerprovider/12096/2 "2021-11-23T20:02:29Z")

</div>

Same problem here, please if you have found something update us 🙂

---

<div class="post-metadata">

**Author:** ![thomasdarimont](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/thomasdarimont/32/37_2.png) [@thomasdarimont](https://forum.keycloak.org/u/thomasdarimont)\
**Post date:** [November 24, 2021, 11:27am UTC](https://forum.keycloak.org/t/extend-timerprovider/12096/3 "2021-11-24T11:27:46Z")

</div>

I think this is a useful enhancement for the Keycloak codebase.  
I create this issue [TimerProvider schedule methods should allow explicit delayConfiguration · Issue #8901 · keycloak/keycloak · GitHub](https://github.com/keycloak/keycloak/issues/8901) to track this.

May I ask what your concrete use case is here?

---

<div class="post-metadata">

**Author:** ![jumpingElephant](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jumpingelephant/32/3538_2.png) [@jumpingElephant](https://forum.keycloak.org/u/jumpingElephant)\
**Post date:** [November 24, 2021, 2:13pm UTC](https://forum.keycloak.org/t/extend-timerprovider/12096/4 "2021-11-24T14:13:57Z")

</div>

My use case arises from reasons of privacy and right to erasure. Similar to this [topic](http://forum.keycloak.org/t/how-to-lock-disable-inactive-account-after-period-of-time/3879/2) I want to run three regularly scheduled tasks to delete accounts.  
Running such tasks at least once per day would be enough, but even this could fail if the interval is too and K8s restarts Keycloak. So it would be easier to configure a short delay instead of running the task multiple times per day. It is easier for testing, too.
