Merge branch 'v1.13' into issue_3704

This commit is contained in:
Hannah Hunter 2024-03-04 10:33:21 -05:00 committed by GitHub
commit 735029f345
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 6 deletions

View File

@ -211,7 +211,7 @@ const randomString = getRandomString();
```go
// DON'T DO THIS!
const currentTime = time.Now()
```
{{% /codetab %}}
@ -254,13 +254,12 @@ const randomString = yield context.callActivity(getRandomString);
{{% /codetab %}}
{{% codetab %}}
```go
// Do this!!
const currentTime = ctx.CurrentUTCDateTime()
```
{{% /codetab %}}
{{< /tabs >}}
@ -319,10 +318,12 @@ fetch('https://postman-echo.com/get')
```go
// DON'T DO THIS!
resp, err := http.Get("http://example.com/api/data")
```
{{% /codetab %}}
{{< /tabs >}}
Do this:
@ -364,6 +365,8 @@ const data = yield ctx.callActivity(makeHttpCall, "https://example.com/api/data"
```go
// Do this!!
err := ctx.CallActivity(MakeHttpCallActivity, workflow.ActivityInput("https://example.com/api/data")).Await(&output)
```
{{% /codetab %}}
@ -412,9 +415,16 @@ Don't declare JavaScript workflow as `async`. The Node.js runtime doesn't guaran
```go
// DON'T DO THIS!
go func() {
err := ctx.CallActivity(DoSomething).Await(nil)
}()
err := ctx.CreateTimer(time.Second).Await(nil)
```
{{% /codetab %}}
{{< /tabs >}}
Do this:
@ -450,7 +460,9 @@ Since the Node.js runtime doesn't guarantee that asynchronous functions are dete
{{% codetab %}}
```go
// Do this!!
// Do this!
task := ctx.CallActivity(DoSomething)
task.Await(nil)
```
{{% /codetab %}}
@ -489,4 +501,4 @@ To work around these constraints:
- [JavaScript](https://github.com/dapr/js-sdk/tree/main/examples/workflow)
- [.NET](https://github.com/dapr/dotnet-sdk/tree/master/examples/Workflow)
- [Java](https://github.com/dapr/java-sdk/tree/master/examples/src/main/java/io/dapr/examples/workflows)
- [Go](https://github.com/dapr/go-sdk/tree/main/examples/workflow/README.md)
- [Go](https://github.com/dapr/go-sdk/tree/main/examples/workflow/README.md)