mirror of
https://github.com/keycloak/keycloak.git
synced 2026-02-03 20:39:33 -05:00
Allow step-runner-task-timeout to be specified using ISO-8601 format
Closes #45987 Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
This commit is contained in:
parent
2111dcf913
commit
63d9a19982
3 changed files with 12 additions and 4 deletions
|
|
@ -50,6 +50,9 @@ An optional duration to wait before executing the step. The duration is defined
|
|||
* `h`: hours
|
||||
* `d`: days
|
||||
|
||||
In addition, ISO-8601 duration format is also supported, for example: `P1DT2H` (1 day and 2 hours). If no time unit is specified,
|
||||
it assumes seconds by default.
|
||||
|
||||
{project_name} provides a set of built-in steps that you can use in your workflows. The steps are targeted at performing actions
|
||||
on the realm resource associated with the event, so that each realm resource type has its own set of steps.
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ by the background task, using the same task thread pool as immediate steps.
|
|||
|
||||
By default, the background task tracking due steps runs every 12 hours, but this interval can be configured by setting the following server configuration option:
|
||||
|
||||
* `spi-events-listener--workflow-event-listener--step-runner-task-interval`: Defines the interval, in milliseconds, at which the background task runs to check for workflow steps that are due for execution.
|
||||
* `spi-events-listener--workflow-event-listener--step-runner-task-interval`: Defines the interval at which the background task runs to check for workflow steps that are due for execution.
|
||||
It follows the same format used in the workflow step `after` field, where you can specify the interval as a number followed by a time unit (`ms`, `s` - default, `m`, `h`, `d`) or using the ISO-8601 duration format.
|
||||
|
||||
You can adjust this interval based on your realm's needs and the expected frequency of workflow executions.
|
||||
|
||||
|
|
@ -33,14 +34,16 @@ You can adjust this interval based on your realm's needs and the expected freque
|
|||
Most of the time, steps are executed in a short amount of time. However, there might be cases where a step takes longer
|
||||
to execute due to various reasons, such as network latency depending on an external service delays, or complex processing logic.
|
||||
|
||||
By default, the timeout for executing a step is set to 1 second. If a step takes longer than this timeout to execute,
|
||||
By default, the timeout for executing a step is set to *1 second*. If a step takes longer than this timeout to execute,
|
||||
it will be marked as failed, and the workflow execution will be halted. If the step is scheduled, it will run again
|
||||
in the next execution window of the background task. If the step is not scheduled, the workflow execution will be marked as failed
|
||||
and that step won't be retried.
|
||||
|
||||
You can configure the timeout for step execution by setting the following server configuration option:
|
||||
|
||||
* `spi-workflow--default--executor-task-timeout`: Defines the timeout, in milliseconds, for executing a workflow step.
|
||||
* `spi-workflow--default--executor-task-timeout`: Defines the timeout for executing a workflow step. It follows the same format used in the workflow step `after` field,
|
||||
where you can specify the interval as a number followed by a time unit (`ms`, `s` - default, `m`, `h`, `d`) or using the ISO-8601 duration format.
|
||||
|
||||
|
||||
== Performance considerations
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import org.keycloak.Config.Scope;
|
||||
import org.keycloak.common.util.DurationConverter;
|
||||
import org.keycloak.component.ComponentModel;
|
||||
import org.keycloak.executors.ExecutorsProvider;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
|
|
@ -43,7 +44,8 @@ public class DefaultWorkflowProviderFactory implements WorkflowProviderFactory<D
|
|||
@Override
|
||||
public void init(Scope config) {
|
||||
blocking = config.getBoolean("executorBlocking", false);
|
||||
taskTimeout = config.getLong("executorTaskTimeout", DEFAULT_EXECUTOR_TASK_TIMEOUT);
|
||||
String executorTimeoutStr = config.get("executorTaskTimeout");
|
||||
taskTimeout = executorTimeoutStr == null ? DEFAULT_EXECUTOR_TASK_TIMEOUT : DurationConverter.parseDuration(executorTimeoutStr).toMillis();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue