[actions] handle errors via channel

This commit is contained in:
2023-10-30 19:59:21 +01:00
parent e9969abf1c
commit 737b90d597
5 changed files with 35 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ import (
type TimeOut struct {
Duration time.Duration
ActionChan chan bool
ActionChan ActionResultChan
}
func (t TimeOut) DryExecute() {
@@ -20,10 +20,10 @@ func (t TimeOut) DryExecute() {
func (t TimeOut) Execute() {
fmt.Printf("Waiting %d seconds\n", t.Duration)
time.Sleep(time.Duration(t.Duration) * time.Second)
t.ActionChan <- true
t.ActionChan <- nil
}
func (t TimeOut) Create(config internal.ActionConfig, c chan bool) (Action, error) {
func (t TimeOut) Create(config internal.ActionConfig, c ActionResultChan) (Action, error) {
var result TimeOut
err := json.Unmarshal(config.Options, &result)