Skip to content

Commit

Permalink
Merge pull request #848 from hqy/master
Browse files Browse the repository at this point in the history
fixed can't raise invalid expire time when set ex param is 0
  • Loading branch information
andymccurdy committed May 8, 2017
2 parents 3db0014 + 3d328fa commit d6c300b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions redis/client.py
Expand Up @@ -1150,12 +1150,12 @@ def set(self, name, value, ex=None, px=None, nx=False, xx=False):
already exists.
"""
pieces = [name, value]
if ex:
if ex is not None:
pieces.append('EX')
if isinstance(ex, datetime.timedelta):
ex = ex.seconds + ex.days * 24 * 3600
pieces.append(ex)
if px:
if px is not None:
pieces.append('PX')
if isinstance(px, datetime.timedelta):
ms = int(px.microseconds / 1000)
Expand Down

0 comments on commit d6c300b

Please sign in to comment.