mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 08:23:47 +01:00
pacer: fix b2 deadlock by defaulting max connections to unlimited
Before this change, the maximum number of connections was set to 10. This means that b2 could deadlock while uploading multipart uploads due to a lock being held longer than it should have been.
This commit is contained in:
parent
c1df3ce08c
commit
96438ff259
@ -29,7 +29,7 @@ func NewPacer(ctx context.Context, c pacer.Calculator) *Pacer {
|
|||||||
p := &Pacer{
|
p := &Pacer{
|
||||||
Pacer: pacer.New(
|
Pacer: pacer.New(
|
||||||
pacer.InvokerOption(pacerInvoker),
|
pacer.InvokerOption(pacerInvoker),
|
||||||
pacer.MaxConnectionsOption(ci.Checkers+ci.Transfers),
|
// pacer.MaxConnectionsOption(ci.Checkers+ci.Transfers),
|
||||||
pacer.RetriesOption(retries),
|
pacer.RetriesOption(retries),
|
||||||
pacer.CalculatorOption(c),
|
pacer.CalculatorOption(c),
|
||||||
),
|
),
|
||||||
|
@ -75,7 +75,7 @@ type Paced func() (bool, error)
|
|||||||
// New returns a Pacer with sensible defaults.
|
// New returns a Pacer with sensible defaults.
|
||||||
func New(options ...Option) *Pacer {
|
func New(options ...Option) *Pacer {
|
||||||
opts := pacerOptions{
|
opts := pacerOptions{
|
||||||
maxConnections: 10,
|
maxConnections: 0,
|
||||||
retries: 3,
|
retries: 3,
|
||||||
}
|
}
|
||||||
for _, o := range options {
|
for _, o := range options {
|
||||||
@ -103,7 +103,7 @@ func New(options ...Option) *Pacer {
|
|||||||
// SetMaxConnections sets the maximum number of concurrent connections.
|
// SetMaxConnections sets the maximum number of concurrent connections.
|
||||||
// Setting the value to 0 will allow unlimited number of connections.
|
// Setting the value to 0 will allow unlimited number of connections.
|
||||||
// Should not be changed once you have started calling the pacer.
|
// Should not be changed once you have started calling the pacer.
|
||||||
// By default this will be set to fs.Config.Checkers.
|
// By default this will be 0.
|
||||||
func (p *Pacer) SetMaxConnections(n int) {
|
func (p *Pacer) SetMaxConnections(n int) {
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
defer p.mu.Unlock()
|
defer p.mu.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user