1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Propagate context in Pipeline

This commit is contained in:
Vladimir Mihailenco
2019-07-25 13:28:15 +03:00
parent 6bc7daa5b1
commit 52ec525849
6 changed files with 33 additions and 17 deletions

View File

@ -41,6 +41,7 @@ type Pipeline struct {
cmdable
statefulCmdable
ctx context.Context
exec pipelineExecer
mu sync.Mutex
@ -98,7 +99,7 @@ func (c *Pipeline) discard() error {
// Exec always returns list of commands and error of the first failed
// command if any.
func (c *Pipeline) Exec() ([]Cmder, error) {
return c.ExecContext(context.Background())
return c.ExecContext(c.ctx)
}
func (c *Pipeline) ExecContext(ctx context.Context) ([]Cmder, error) {