From 01678000b157f1aa1db92dad533752da5faef7ca Mon Sep 17 00:00:00 2001 From: Hannah Hunter Date: Mon, 22 May 2023 11:07:26 -0400 Subject: [PATCH] add example of parseduration Signed-off-by: Hannah Hunter --- .../actors/actors-runtime-config.md | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/daprdocs/content/en/developing-applications/building-blocks/actors/actors-runtime-config.md b/daprdocs/content/en/developing-applications/building-blocks/actors/actors-runtime-config.md index c1c5a73e5..3d09024fd 100644 --- a/daprdocs/content/en/developing-applications/building-blocks/actors/actors-runtime-config.md +++ b/daprdocs/content/en/developing-applications/building-blocks/actors/actors-runtime-config.md @@ -20,7 +20,35 @@ You can modify the default Dapr actor runtime behavior using the following confi | `entitiesConfig` | Configure each actor type individually with an array of configurations. Any entity specified in the individual entity configurations must also be specified in the top level `entities` field. | N/A | {{% alert title="Note" color="primary" %}} -Timeouts and intervals use [Go's ParseDuration](https://pkg.go.dev/time#ParseDuration) format. +Actor timeouts and intervals use [Go's ParseDuration](https://pkg.go.dev/time#ParseDuration) format. For example, to set a timeout of 30 seconds with intervals of 5 minutes: + +```go +func main() { + timeout := "30s" + interval := "5m" + + // Parsing timeout + timeoutDuration, err := time.ParseDuration(timeout) + if err != nil { + fmt.Printf("Error parsing timeout duration: %v\n", err) + return + } + + // Parsing interval + intervalDuration, err := time.ParseDuration(interval) + if err != nil { + fmt.Printf("Error parsing interval duration: %v\n", err) + return + } +} +``` + +You can use various string formats to represent durations, including: +- `1h30m` or `1.5h`: A duration of 1 hour and 30 minutes +- `1d12h`: A duration of 1 day and 12 hours +- `500ms`: A duration of 500 milliseconds +- `-30m`: A negative duration of 30 minutes + {{% /alert %}} ## Examples