change run once task trigger to on registration

This commit is contained in:
sadnub 2023-11-21 23:08:53 -05:00
parent 753242a949
commit e6fea56198

View File

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