mirror of https://github.com/dapr/docs.git
Merge branch 'v1.13' into issue_3704
This commit is contained in:
commit
735029f345
|
@ -211,7 +211,7 @@ const randomString = getRandomString();
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
const currentTime = time.Now()
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
@ -254,13 +254,12 @@ const randomString = yield context.callActivity(getRandomString);
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
const currentTime = ctx.CurrentUTCDateTime()
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
@ -319,10 +318,12 @@ fetch('https://postman-echo.com/get')
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
resp, err := http.Get("http://example.com/api/data")
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
Do this:
|
Do this:
|
||||||
|
@ -364,6 +365,8 @@ const data = yield ctx.callActivity(makeHttpCall, "https://example.com/api/data"
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
// Do this!!
|
||||||
|
err := ctx.CallActivity(MakeHttpCallActivity, workflow.ActivityInput("https://example.com/api/data")).Await(&output)
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
@ -412,9 +415,16 @@ Don't declare JavaScript workflow as `async`. The Node.js runtime doesn't guaran
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// DON'T DO THIS!
|
// DON'T DO THIS!
|
||||||
|
go func() {
|
||||||
|
err := ctx.CallActivity(DoSomething).Await(nil)
|
||||||
|
}()
|
||||||
|
err := ctx.CreateTimer(time.Second).Await(nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{{< /tabs >}}
|
{{< /tabs >}}
|
||||||
|
|
||||||
Do this:
|
Do this:
|
||||||
|
@ -450,7 +460,9 @@ Since the Node.js runtime doesn't guarantee that asynchronous functions are dete
|
||||||
{{% codetab %}}
|
{{% codetab %}}
|
||||||
|
|
||||||
```go
|
```go
|
||||||
// Do this!!
|
// Do this!
|
||||||
|
task := ctx.CallActivity(DoSomething)
|
||||||
|
task.Await(nil)
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% /codetab %}}
|
{{% /codetab %}}
|
||||||
|
|
Loading…
Reference in New Issue