Skip to content

Commit d8683f1

Browse files
author
“Kevin”
committed
Create main package
Signed-off-by: “Kevin” <“[email protected]”>
1 parent 01722c9 commit d8683f1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

cmd/samples/batch/workflow.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
package batch
1+
package main
22

33
import (
44
"context"
55
"fmt"
6-
"math/rand"
76
"time"
87

98
"go.uber.org/cadence/workflow"
109
"go.uber.org/cadence/x"
1110
)
1211

12+
// ApplicationName is the task list for this sample
13+
const ApplicationName = "batchGroup"
14+
15+
const batchWorkflowName = "batchWorkflow"
16+
1317
type BatchWorkflowInput struct {
1418
Concurrency int
1519
TotalSize int
@@ -21,8 +25,8 @@ func BatchWorkflow(ctx workflow.Context, input BatchWorkflowInput) error {
2125
taskID := taskID
2226
factories[taskID] = func(ctx workflow.Context) workflow.Future {
2327
aCtx := workflow.WithActivityOptions(ctx, workflow.ActivityOptions{
24-
ScheduleToStartTimeout: time.Second * 10,
25-
StartToCloseTimeout: time.Second * 10,
28+
ScheduleToStartTimeout: time.Minute * 10,
29+
StartToCloseTimeout: time.Minute * 10,
2630
})
2731
return workflow.ExecuteActivity(aCtx, BatchActivity, taskID)
2832
}
@@ -40,7 +44,7 @@ func BatchActivity(ctx context.Context, taskID int) error {
4044
select {
4145
case <-ctx.Done():
4246
return fmt.Errorf("batch activity %d failed: %w", taskID, ctx.Err())
43-
case <-time.After(time.Duration(rand.Int63n(100))*time.Millisecond + 900*time.Millisecond):
47+
case <-time.After(time.Duration(10000)*time.Millisecond):
4448
return nil
4549
}
4650
}

cmd/samples/batch/workflow_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package batch
1+
package main
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)