MCPcopy Index your code
hub / github.com/cloudfoundry/cli / PollTask

Method PollTask

actor/v7action/task.go:75–102  ·  view source on GitHub ↗
(task resources.Task)

Source from the content-addressed store, hash-verified

73}
74
75func (actor Actor) PollTask(task resources.Task) (resources.Task, Warnings, error) {
76 var allWarnings Warnings
77
78 for task.State != constant.TaskSucceeded && task.State != constant.TaskFailed {
79
80 time.Sleep(actor.Config.PollingInterval())
81
82 ccTask, warnings, err := actor.CloudControllerClient.GetTask(task.GUID)
83 log.WithFields(log.Fields{
84 "task_guid": task.GUID,
85 "state": task.State,
86 }).Debug("polling task state")
87
88 allWarnings = append(allWarnings, warnings...)
89
90 if err != nil {
91 return resources.Task{}, allWarnings, err
92 }
93
94 task = resources.Task(ccTask)
95 }
96
97 if task.State == constant.TaskFailed {
98 return task, allWarnings, actionerror.TaskFailedError{}
99 }
100
101 return task, allWarnings, nil
102}

Callers

nothing calls this directly

Implementers 1

FakeActorcommand/v7/v7fakes/fake_actor.go

Calls 3

TaskStruct · 0.92
PollingIntervalMethod · 0.65
GetTaskMethod · 0.65

Tested by

no test coverage detected