mirror of
https://github.com/redis/go-redis.git
synced 2025-12-02 06:22:31 +03:00
fix unsafe test
This commit is contained in:
@@ -3,6 +3,7 @@ package pool_test
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
|
"sync/atomic"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
. "github.com/bsm/ginkgo/v2"
|
. "github.com/bsm/ginkgo/v2"
|
||||||
@@ -130,7 +131,8 @@ var _ = Describe("Buffer Size Configuration", func() {
|
|||||||
func getWriterBufSizeUnsafe(cn *pool.Conn) int {
|
func getWriterBufSizeUnsafe(cn *pool.Conn) int {
|
||||||
cnPtr := (*struct {
|
cnPtr := (*struct {
|
||||||
id uint64 // First field in pool.Conn
|
id uint64 // First field in pool.Conn
|
||||||
usedAt int64 // Second field (atomic)
|
usedAt atomic.Int64 // Second field (atomic)
|
||||||
|
lastPutAt atomic.Int64 // Third field (atomic)
|
||||||
netConnAtomic interface{} // atomic.Value (interface{} has same size)
|
netConnAtomic interface{} // atomic.Value (interface{} has same size)
|
||||||
rd *proto.Reader
|
rd *proto.Reader
|
||||||
bw *bufio.Writer
|
bw *bufio.Writer
|
||||||
@@ -156,7 +158,8 @@ func getWriterBufSizeUnsafe(cn *pool.Conn) int {
|
|||||||
func getReaderBufSizeUnsafe(cn *pool.Conn) int {
|
func getReaderBufSizeUnsafe(cn *pool.Conn) int {
|
||||||
cnPtr := (*struct {
|
cnPtr := (*struct {
|
||||||
id uint64 // First field in pool.Conn
|
id uint64 // First field in pool.Conn
|
||||||
usedAt int64 // Second field (atomic)
|
usedAt atomic.Int64 // Second field (atomic)
|
||||||
|
lastPutAt atomic.Int64 // Third field (atomic)
|
||||||
netConnAtomic interface{} // atomic.Value (interface{} has same size)
|
netConnAtomic interface{} // atomic.Value (interface{} has same size)
|
||||||
rd *proto.Reader
|
rd *proto.Reader
|
||||||
bw *bufio.Writer
|
bw *bufio.Writer
|
||||||
|
|||||||
Reference in New Issue
Block a user