mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-22 15:53:45 +00:00
31 lines
674 B
Go
31 lines
674 B
Go
package workflows
|
|
|
|
import (
|
|
"time"
|
|
|
|
"code.tjo.space/mentos1386/zdravko/internal/activities"
|
|
"go.temporal.io/sdk/workflow"
|
|
)
|
|
|
|
type HealthcheckWorkflowParam struct {
|
|
Script string
|
|
}
|
|
|
|
func HealthcheckWorkflowDefinition(ctx workflow.Context, param HealthcheckWorkflowParam) error {
|
|
options := workflow.ActivityOptions{
|
|
StartToCloseTimeout: 10 * time.Second,
|
|
}
|
|
ctx = workflow.WithActivityOptions(ctx, options)
|
|
|
|
activityParam := activities.HealtcheckParam{
|
|
Script: param.Script,
|
|
}
|
|
|
|
var result *activities.HealthcheckResult
|
|
err := workflow.ExecuteActivity(ctx, activities.Healthcheck, activityParam).Get(ctx, &result)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|