-/*
- Keepstore initiates pull worker channel goroutine.
- The channel will process pull list.
- For each (next) pull request:
- For each locator listed, execute Pull on the server(s) listed
- Skip the rest of the servers if no errors
- Repeat
-*/
-func RunPullWorker(pullq *WorkQueue, keepClient keepclient.KeepClient) {
- nextItem := pullq.NextItem
- for item := range nextItem {
- pullRequest := item.(PullRequest)
- err := PullItemAndProcess(item.(PullRequest), GenerateRandomApiToken(), keepClient)
+// RunPullWorker receives PullRequests from pullq, invokes
+// PullItemAndProcess on each one. After each PR, it logs a message
+// indicating whether the pull was successful.
+func (h *handler) runPullWorker(pullq *WorkQueue) {
+ for item := range pullq.NextItem {
+ pr := item.(PullRequest)
+ err := h.pullItemAndProcess(pr)
+ pullq.DoneItem <- struct{}{}