Skip to content

Commit

Permalink
use decode_responses=True for python3 compatibillity
Browse files Browse the repository at this point in the history
  • Loading branch information
danni-m committed Aug 28, 2019
1 parent dae3676 commit 471e406
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/traffic_simulator/traffic_simulator.py
Expand Up @@ -7,7 +7,7 @@

def worker_func(args):
host, port, start_ts, tsrange, pipeline_size, key_index, key_format, check_only = args
redis_client = redis.Redis(host, port)
redis_client = redis.Redis(host, port, decode_responses=True)
if check_only:
res = redis_client.execute_command('TS.RANGE', key_format.format(index=key_index), 0, start_ts + tsrange)
if len(res) != tsrange:
Expand Down Expand Up @@ -48,7 +48,7 @@ def create_compacted_key(redis, i, source, agg, bucket):
@click.option('--check-only', type=click.BOOL, default=False, help='test if all keys are correcly exists in the database')
def run(host, port, key_count, samples, pool_size, create_keys, pipeline_size, with_compaction, start_timestamp,
key_format, check_only):
r = redis.Redis(host, port)
r = redis.Redis(host, port, decode_responses=True)
print("from %s to %s" % (start_timestamp, start_timestamp + samples))

if create_keys and not check_only:
Expand All @@ -72,9 +72,9 @@ def run(host, port, key_count, samples, pool_size, create_keys, pipeline_size, w
if(check_only):
for r in result:
if r == -1:
print("# failed!!! not all items exists in the databse")
print("# failed!!! not all items exists in the database")
sys.exit(1)
print("# pass, all items exists in the databse")
print("# pass, all items exists in the database")
else:
print("# items inserted %s:" % sum(result))
print("took %s to insert sec, average insert time %s" % (insert_time, insert_time * 1000 / sum(result)))
Expand Down

0 comments on commit 471e406

Please sign in to comment.