Skip to content

Commit

Permalink
bugfix: token expire time
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaomingqiang committed Feb 10, 2022
1 parent 70fda5b commit 426e94b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ back to you as soon as possible.

```shell
pip install typing # python version < 3.5
pip install larksuite-oapi==1.0.32
pip install larksuite-oapi==1.0.33
```

## Explanation of terms
Expand Down
2 changes: 1 addition & 1 deletion README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

```shell
pip install typing # python version < 3.5
pip install larksuite-oapi==1.0.32
pip install larksuite-oapi==1.0.33
```

## 术语解释
Expand Down
2 changes: 1 addition & 1 deletion src/larksuiteoapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
from .logger import *
from .store import *

VERSION = "1.0.32"
VERSION = "1.0.33"
8 changes: 4 additions & 4 deletions src/larksuiteoapi/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def set(self, key, value, expire): # type: (str, str, int) -> None


class ExpireValue(object):
def __init__(self, value, expire): # type: (str, int) -> None
def __init__(self, value, expireTime): # type: (str, int) -> None
self.value = value
self.expire = expire
self.expireTime = expireTime


class MemoryStore(Store):
Expand All @@ -43,7 +43,7 @@ def get(self, key): # type: (str) -> Tuple[bool, str]
if val is None:
return False, ""
else:
if val.expire < int(time.time()):
if val.expireTime < int(time.time()):
self.data.pop(key)
return False, ""
else:
Expand All @@ -58,6 +58,6 @@ def set(self, key, value, expire): # type: (str, str, int) -> None
"""
self.mutex.acquire()
try:
self.data[key] = ExpireValue(value, expire)
self.data[key] = ExpireValue(value, int(time.time()) + expire)
finally:
self.mutex.release()

0 comments on commit 426e94b

Please sign in to comment.