MCPcopy Index your code
hub / github.com/GoEdgeLab/EdgeNode / TestLimiter_SetThreads

Function TestLimiter_SetThreads

internal/utils/fs/limiter_test.go:15–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13)
14
15func TestLimiter_SetThreads(t *testing.T) {
16 var limiter = fsutils.NewLimiter(4)
17
18 var concurrent = 1024
19
20 var wg = sync.WaitGroup{}
21 wg.Add(concurrent)
22
23 for i := 0; i < concurrent; i++ {
24 go func() {
25 defer wg.Done()
26
27 limiter.SetThreads(rand.Int() % 128)
28 limiter.TryAck()
29 }()
30 }
31
32 wg.Wait()
33}
34
35func TestLimiter_Ack(t *testing.T) {
36 var a = assert.NewAssertion(t)

Callers

nothing calls this directly

Calls 5

DoneMethod · 0.80
SetThreadsMethod · 0.80
TryAckMethod · 0.80
AddMethod · 0.65
WaitMethod · 0.45

Tested by

no test coverage detected