Skip to content

Commit

Permalink
Fix processing of None in delete_all_events() and delete_temporary_bi…
Browse files Browse the repository at this point in the history
…top_keys()

Bitmapist-server at least up to version v1.5.2 returns Null in response
to KEYS command if not keys are found. This workaround prevents crashing
the client with an exception "TypeError: object of type 'NoneType' has
no len()"

Closes #31
  • Loading branch information
imankulov committed Dec 19, 2019
1 parent 8813475 commit 9c1c4b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bitmapist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def delete_all_events(system='default'):
"""
cli = get_redis(system)
keys = cli.keys('trackist_*')
if len(keys) > 0:
if keys:
cli.delete(*keys)


Expand All @@ -279,7 +279,7 @@ def delete_temporary_bitop_keys(system='default'):
"""
cli = get_redis(system)
keys = cli.keys('trackist_bitop_*')
if len(keys) > 0:
if keys:
cli.delete(*keys)


Expand Down

0 comments on commit 9c1c4b8

Please sign in to comment.