From 0c4e28bd625e2885b5b2cd712377f51abe0bea61 Mon Sep 17 00:00:00 2001 From: zhangliyong Date: Fri, 22 Aug 2014 10:08:15 +0800 Subject: [PATCH] Use 'with Connection' instead of 'use_connection' --- rq/scripts/rqinfo.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rq/scripts/rqinfo.py b/rq/scripts/rqinfo.py index fa402a8..7f96c5f 100755 --- a/rq/scripts/rqinfo.py +++ b/rq/scripts/rqinfo.py @@ -9,7 +9,7 @@ import click from functools import partial from redis.exceptions import ConnectionError -from rq import Queue, Worker, use_connection +from rq import Queue, Worker, Connection red = partial(click.style, fg='red') @@ -163,7 +163,6 @@ def info(ctx, path, interval, raw, only_queues, only_workers, by_queue, queues): sys.path = path.split(':') + sys.path conn = ctx.obj['connection'] - use_connection(conn) try: if only_queues: func = show_queues @@ -172,7 +171,8 @@ def info(ctx, path, interval, raw, only_queues, only_workers, by_queue, queues): else: func = show_both - refresh(interval, func, queues, raw, by_queue) + with Connection(conn): + refresh(interval, func, queues, raw, by_queue) except ConnectionError as e: click.echo(e) sys.exit(1)