add onboarding task type and revert runonce

This commit is contained in:
sadnub 2023-11-22 23:38:20 -05:00
parent 1814d0f19d
commit db17e3e28e

View File

@ -180,7 +180,7 @@ func (a *Agent) CreateSchedTask(st SchedTask) (bool, error) {
Enabled: st.Enabled, Enabled: st.Enabled,
StartBoundary: now, StartBoundary: now,
} }
} else if st.Trigger == "runonce" { } else if st.Trigger == "onboarding" {
tasktrigger = taskmaster.TaskTrigger{ tasktrigger = taskmaster.TaskTrigger{
Enabled: st.Enabled, Enabled: st.Enabled,
} }
@ -205,6 +205,12 @@ func (a *Agent) CreateSchedTask(st SchedTask) (bool, error) {
switch st.Trigger { switch st.Trigger {
case "runonce": case "runonce":
trigger = taskmaster.TimeTrigger{
TaskTrigger: tasktrigger,
RandomDelay: st.RandomDelay,
}
case "onboarding":
trigger = taskmaster.RegistrationTrigger{ trigger = taskmaster.RegistrationTrigger{
TaskTrigger: tasktrigger, TaskTrigger: tasktrigger,
Delay: st.RandomDelay, Delay: st.RandomDelay,