1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Change Tx.Pipeline and Tx.TxPipeline meaning

This commit is contained in:
Vladimir Mihailenco
2020-01-12 14:19:21 +02:00
parent 08dad1eb7f
commit dd4ef4e9cb
8 changed files with 48 additions and 42 deletions

View File

@ -253,7 +253,7 @@ var _ = Describe("Ring watch", func() {
return err
}
_, err = tx.Pipelined(func(pipe redis.Pipeliner) error {
_, err = tx.TxPipelined(func(pipe redis.Pipeliner) error {
pipe.Set(key, strconv.FormatInt(n+1, 10), 0)
return nil
})
@ -285,7 +285,7 @@ var _ = Describe("Ring watch", func() {
It("should discard", func() {
err := ring.Watch(func(tx *redis.Tx) error {
cmds, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
cmds, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
pipe.Set("key1", "hello1", 0)
pipe.Discard()
pipe.Set("key2", "hello2", 0)
@ -308,7 +308,7 @@ var _ = Describe("Ring watch", func() {
It("returns no error when there are no commands", func() {
err := ring.Watch(func(tx *redis.Tx) error {
_, err := tx.Pipelined(func(redis.Pipeliner) error { return nil })
_, err := tx.TxPipelined(func(redis.Pipeliner) error { return nil })
return err
}, "key")
Expect(err).NotTo(HaveOccurred())
@ -322,7 +322,7 @@ var _ = Describe("Ring watch", func() {
const N = 20000
err := ring.Watch(func(tx *redis.Tx) error {
cmds, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
cmds, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
for i := 0; i < N; i++ {
pipe.Incr("key")
}
@ -358,7 +358,7 @@ var _ = Describe("Ring watch", func() {
num, err := strconv.ParseInt(val, 10, 64)
Expect(err).NotTo(HaveOccurred())
cmds, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
cmds, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
pipe.Set("key", strconv.FormatInt(num+1, 10), 0)
return nil
})
@ -380,7 +380,7 @@ var _ = Describe("Ring watch", func() {
It("should close Tx without closing the client", func() {
err := ring.Watch(func(tx *redis.Tx) error {
_, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
_, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
pipe.Ping()
return nil
})
@ -396,7 +396,7 @@ var _ = Describe("Ring watch", func() {
var ping *redis.StatusCmd
err := ring.Watch(func(tx *redis.Tx) error {
cmds, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
cmds, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
ping = pipe.Ping()
return nil
})
@ -443,7 +443,7 @@ var _ = Describe("Ring Tx timeout", func() {
It("Tx Pipeline timeouts", func() {
err := ring.Watch(func(tx *redis.Tx) error {
_, err := tx.Pipelined(func(pipe redis.Pipeliner) error {
_, err := tx.TxPipelined(func(pipe redis.Pipeliner) error {
pipe.Ping()
return nil
})