mirror of
https://github.com/redis/go-redis.git
synced 2025-07-19 11:43:14 +03:00
Tweak transaction API.
This commit is contained in:
17
pool_test.go
17
pool_test.go
@ -37,18 +37,19 @@ var _ = Describe("pool", func() {
|
||||
perform(1000, func(id int) {
|
||||
var ping *redis.StatusCmd
|
||||
|
||||
tx, err := client.Watch()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
cmds, err := tx.Exec(func() error {
|
||||
ping = tx.Ping()
|
||||
return nil
|
||||
err := client.Watch(func(tx *redis.Tx) error {
|
||||
cmds, err := tx.MultiExec(func() error {
|
||||
ping = tx.Ping()
|
||||
return nil
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(cmds).To(HaveLen(1))
|
||||
return err
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(cmds).To(HaveLen(1))
|
||||
|
||||
Expect(ping.Err()).NotTo(HaveOccurred())
|
||||
Expect(ping.Val()).To(Equal("PONG"))
|
||||
Expect(tx.Close()).NotTo(HaveOccurred())
|
||||
})
|
||||
|
||||
pool := client.Pool()
|
||||
|
Reference in New Issue
Block a user