Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion samples/activity-registration/activity-registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("activity-registration")
b := samples.GetBackend("activity-registration", true)

go RunWorker(ctx, b)

Expand Down
2 changes: 1 addition & 1 deletion samples/cancellation/cancellation.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func main() {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)

b := samples.GetBackend("cancellation")
b := samples.GetBackend("cancellation", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/complex-parameters/complex-parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("complex-parameters")
b := samples.GetBackend("complex-parameters", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/concurrent/concurrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("concurrent")
b := samples.GetBackend("concurrent", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/context-propagation/context_propagation.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("simple", backend.WithContextPropagator(&myPropagator{}))
b := samples.GetBackend("simple", true, backend.WithContextPropagator(&myPropagator{}))

// Run worker
w := RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/continue-as-new/continue-as-new.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("continue-as-new")
b := samples.GetBackend("continue-as-new", true)

db, ok := b.(diag.Backend)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion samples/converter/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (*CustomConverter) To(v interface{}) (payload.Payload, error) {
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("converter", backend.WithConverter(&CustomConverter{}))
b := samples.GetBackend("converter", true, backend.WithConverter(&CustomConverter{}))

// Run worker
w := RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("errors")
b := samples.GetBackend("errors", true)

db, ok := b.(diag.Backend)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion samples/orchestrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

backend := samples.GetBackend("orchestrator", backend.WithWorkerName("orchestrator-worker"))
backend := samples.GetBackend("orchestrator", true, backend.WithWorkerName("orchestrator-worker"))

orchestrator := worker.NewWorkflowOrchestrator(
backend,
Expand Down
2 changes: 1 addition & 1 deletion samples/queues/queues.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("queues", backend.WithLogger(slog.Default()))
b := samples.GetBackend("queues", true, backend.WithLogger(slog.Default()))

db, ok := b.(diag.Backend)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion samples/retries/retries.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("retries")
b := samples.GetBackend("retries", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
6 changes: 4 additions & 2 deletions samples/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
redisv9 "github.com/redis/go-redis/v9"
)

func GetBackend(name string, opt ...backend.BackendOption) backend.Backend {
func GetBackend(name string, recreate bool, opt ...backend.BackendOption) backend.Backend {
b := flag.String("backend", "redis", "backend to use: memory, sqlite, mysql, redis")
flag.Parse()

Expand Down Expand Up @@ -53,7 +53,9 @@ func GetBackend(name string, opt ...backend.BackendOption) backend.Backend {
ReadTimeout: time.Second * 30,
})

rclient.FlushAll(context.Background()).Result()
if recreate {
rclient.FlushAll(context.Background()).Result()
}

b, err := redis.NewRedisBackend(rclient, redis.WithBackendOptions(opt...))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion samples/scale/starter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var count int32

func main() {
ctx := context.Background()
b := samples.GetBackend("scale")
b := samples.GetBackend("scale", false)

count = int32(*tostart)

Expand Down
2 changes: 1 addition & 1 deletion samples/scale/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {

ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("scale")
b := samples.GetBackend("scale", false)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/signal-subworkflow/subworkflow-signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("subworkflow-signal")
b := samples.GetBackend("subworkflow-signal", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/signal/signal.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("signal")
b := samples.GetBackend("signal", true)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/simple-split-worker/starter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("simple-split")
b := samples.GetBackend("simple-split", false)

// Start workflow via client
c := client.New(b)
Expand Down
2 changes: 1 addition & 1 deletion samples/simple-split-worker/worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func main() {
ctx := context.Background()

b := samples.GetBackend("simple-split")
b := samples.GetBackend("simple-split", false)

// Run worker
go RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/simple/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("simple")
b := samples.GetBackend("simple", true)

// Run worker
w := RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/subworkflow/subworkflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("subworkflow")
b := samples.GetBackend("subworkflow", true)

// Run worker
w := RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/timer/timer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func main() {
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)

b := samples.GetBackend("timer")
b := samples.GetBackend("timer", true)

// Run worker
w := RunWorker(ctx, b)
Expand Down
2 changes: 1 addition & 1 deletion samples/tracing/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func main() {

otel.SetTracerProvider(tp)

b := samples.GetBackend("tracing",
b := samples.GetBackend("tracing", true,
backend.WithTracerProvider(tp),
backend.WithStickyTimeout(0),
)
Expand Down
2 changes: 1 addition & 1 deletion samples/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("web")
b := samples.GetBackend("web", true)

db, ok := b.(diag.Backend)
if !ok {
Expand Down
2 changes: 1 addition & 1 deletion samples/workflow-registration/workflow_registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
func main() {
ctx, cancel := context.WithCancel(context.Background())

b := samples.GetBackend("simple")
b := samples.GetBackend("simple", true)

// Run worker
w := RunWorker(ctx, b)
Expand Down
Loading