We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a7332a9 + 90c345c commit 5735e12Copy full SHA for 5735e12
utils/bytes_buffer_pool.go
@@ -15,29 +15,17 @@ var (
15
return &bytes.Buffer{}
16
},
17
}
18
- bytesBufferChan = make(chan *bytes.Buffer, 10)
19
)
20
21
func BytesBufferGet() (data *bytes.Buffer) {
22
- select {
23
- case data = <-bytesBufferChan:
24
- default:
25
- data = bytesBufferPool.Get().(*bytes.Buffer)
26
- }
27
-
+ data = bytesBufferPool.Get().(*bytes.Buffer)
28
data.Reset()
29
30
return data
31
32
33
func BytesBufferPut(data *bytes.Buffer) {
34
if data == nil || len(data.Bytes()) > TooBigBlockSize {
35
return
36
37
38
39
- case bytesBufferChan <- data:
40
41
- bytesBufferPool.Put(data)
42
+ bytesBufferPool.Put(data)
43
0 commit comments