MCPcopy Create free account
hub / github.com/go-git/go-git / TestConcurrentAccess

Method TestConcurrentAccess

plumbing/cache/object_test.go:122–148  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

120}
121
122func (s *ObjectSuite) TestConcurrentAccess(c *C) {
123 for _, o := range s.c {
124 var wg sync.WaitGroup
125
126 for i := 0; i < 1000; i++ {
127 wg.Add(3)
128 go func(i int) {
129 o.Put(newObject(fmt.Sprint(i), FileSize(i)))
130 wg.Done()
131 }(i)
132
133 go func(i int) {
134 if i%30 == 0 {
135 o.Clear()
136 }
137 wg.Done()
138 }(i)
139
140 go func(i int) {
141 o.Get(plumbing.NewHash(fmt.Sprint(i)))
142 wg.Done()
143 }(i)
144 }
145
146 wg.Wait()
147 }
148}
149
150func (s *ObjectSuite) TestDefaultLRU(c *C) {
151 defaultLRU := s.c["default_lru"].(*ObjectLRU)

Callers

nothing calls this directly

Calls 7

NewHashFunction · 0.92
FileSizeTypeAlias · 0.85
newObjectFunction · 0.70
PutMethod · 0.65
ClearMethod · 0.65
GetMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected