Fix a logic error, make sure the batcher exits on retry, add some tracing
This commit is contained in:
parent
826e519449
commit
66aa279f28
@ -202,6 +202,10 @@ func Batch(objects []*objectResource, operation string) ([]*objectResource, erro
|
|||||||
return nil, newRetriableError(err)
|
return nil, newRetriableError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if res.StatusCode == 0 {
|
||||||
|
return nil, newRetriableError(err)
|
||||||
|
}
|
||||||
|
|
||||||
switch res.StatusCode {
|
switch res.StatusCode {
|
||||||
case 401:
|
case 401:
|
||||||
Config.SetAccess(AuthTypeBasic)
|
Config.SetAccess(AuthTypeBasic)
|
||||||
|
@ -90,10 +90,16 @@ func (q *TransferQueue) Wait() {
|
|||||||
atomic.StoreUint32(&q.retrying, 1)
|
atomic.StoreUint32(&q.retrying, 1)
|
||||||
|
|
||||||
if len(q.retries) > 0 {
|
if len(q.retries) > 0 {
|
||||||
q.batcher.Reset()
|
tracerx.Printf("tq: retrying %d failed transfers", len(q.retries))
|
||||||
|
if q.batcher != nil {
|
||||||
|
q.batcher.Reset()
|
||||||
|
}
|
||||||
for _, t := range q.retries {
|
for _, t := range q.retries {
|
||||||
q.Add(t)
|
q.Add(t)
|
||||||
}
|
}
|
||||||
|
if q.batcher != nil {
|
||||||
|
q.batcher.Exit()
|
||||||
|
}
|
||||||
q.wait.Wait()
|
q.wait.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +213,6 @@ func (q *TransferQueue) batchApiRoutine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if q.canRetry(err) {
|
if q.canRetry(err) {
|
||||||
tracerx.Printf("tq: resubmitting batch: %s", err)
|
|
||||||
for _, t := range batch {
|
for _, t := range batch {
|
||||||
q.retry(t)
|
q.retry(t)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user