mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Fix WithContext race
This commit is contained in:
4
tx.go
4
tx.go
@ -15,10 +15,9 @@ const TxFailedErr = proto.RedisError("redis: transaction failed")
|
||||
// by multiple goroutines, because Exec resets list of watched keys.
|
||||
// If you don't need WATCH it is better to use Pipeline.
|
||||
type Tx struct {
|
||||
baseClient
|
||||
cmdable
|
||||
statefulCmdable
|
||||
baseClient
|
||||
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
@ -49,6 +48,7 @@ func (c *Tx) WithContext(ctx context.Context) *Tx {
|
||||
}
|
||||
clone := *c
|
||||
clone.ctx = ctx
|
||||
clone.init()
|
||||
return &clone
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user