func dispatch(trigger string) (string, error) { scheduler, err := scheduler.NewScheduler() if err != nil { return "Failed to create scheduler", err } if err := scheduler.Dispatch(trigger); err != nil { return fmt.Sprintf("Failed to dispatch event(%s)", trigger), err } return "", nil }
func agent() (string, error) { time.Sleep(5 * time.Second) scheduler, err := scheduler.NewScheduler() if err != nil { return "Failed to create scheduler", err } go scheduler.Run() return waitSignal() }