MCPcopy
hub / github.com/rclone/rclone / TestCallMaxConnectionsRecursiveDeadlock

Function TestCallMaxConnectionsRecursiveDeadlock

lib/pacer/pacer_test.go:356–368  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

354}
355
356func TestCallMaxConnectionsRecursiveDeadlock(t *testing.T) {
357 p := New(CalculatorOption(NewDefault(MinSleep(1*time.Millisecond), MaxSleep(2*time.Millisecond))))
358 p.SetMaxConnections(1)
359 dp := &dummyPaced{retry: false}
360 err := p.Call(func() (bool, error) {
361 // check we have taken the connection token
362 // no tokens left means deadlock on the recursive call
363 assert.Equal(t, 0, len(p.connTokens))
364 return false, p.Call(dp.fn)
365 })
366 assert.Equal(t, 1, dp.called)
367 assert.Equal(t, errFoo, err)
368}
369
370func TestCallMaxConnectionsRecursiveDeadlock2(t *testing.T) {
371 p := New(CalculatorOption(NewDefault(MinSleep(1*time.Millisecond), MaxSleep(2*time.Millisecond))))

Callers

nothing calls this directly

Calls 8

CalculatorOptionFunction · 0.85
NewDefaultFunction · 0.85
MinSleepTypeAlias · 0.85
MaxSleepTypeAlias · 0.85
SetMaxConnectionsMethod · 0.80
NewFunction · 0.70
CallMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…