Extend TimerProvider

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?

1 Like

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

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 to track this.

May I ask what your concrete use case is here?

My use case arises from reasons of privacy and right to erasure. Similar to this topic 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.