func MarkTaskDispatched(t *task.Task, hostId, distroId string) error { // record that the task was dispatched on the host if err := t.MarkAsDispatched(hostId, distroId, time.Now()); err != nil { return fmt.Errorf("error marking task %v as dispatched "+ "on host %v: %v", t.Id, hostId, err) } // the task was successfully dispatched, log the event event.LogTaskDispatched(t.Id, hostId) // update the cached version of the task in its related build document if err := build.SetCachedTaskDispatched(t.BuildId, t.Id); err != nil { return fmt.Errorf("error updating task cache in build %v: %v", t.BuildId, err) } return nil }