tq: pause before making batch request

This commit is contained in:
risk danger olson 2017-01-24 14:12:07 -07:00
parent 3dece4d862
commit 7f4334c758

@ -105,7 +105,6 @@ type TransferQueue struct {
errorc chan error // Channel for processing errors errorc chan error // Channel for processing errors
watchers []chan string watchers []chan string
trMutex *sync.Mutex trMutex *sync.Mutex
startProgress sync.Once
collectorWait sync.WaitGroup collectorWait sync.WaitGroup
errorwait sync.WaitGroup errorwait sync.WaitGroup
// wait is used to keep track of pending transfers. It is incremented // wait is used to keep track of pending transfers. It is incremented
@ -283,6 +282,7 @@ func (q *TransferQueue) enqueueAndCollectRetriesFor(batch batch) (batch, error)
next := q.makeBatch() next := q.makeBatch()
tracerx.Printf("tq: sending batch of size %d", len(batch)) tracerx.Printf("tq: sending batch of size %d", len(batch))
q.meter.Pause()
bRes, err := Batch(q.manifest, q.direction, q.remote, batch.ToTransfers()) bRes, err := Batch(q.manifest, q.direction, q.remote, batch.ToTransfers())
if err != nil { if err != nil {
// If there was an error making the batch API call, mark all of // If there was an error making the batch API call, mark all of
@ -307,7 +307,7 @@ func (q *TransferQueue) enqueueAndCollectRetriesFor(batch batch) (batch, error)
} }
q.useAdapter(bRes.TransferAdapterName) q.useAdapter(bRes.TransferAdapterName)
q.startProgress.Do(q.meter.Start) q.meter.Start()
toTransfer := make([]*Transfer, 0, len(bRes.Objects)) toTransfer := make([]*Transfer, 0, len(bRes.Objects))