diff options
author | Adrian Tschira <nota@notafile.com> | 2018-04-30 16:38:23 +0200 |
---|---|---|
committer | Adrian Tschira <nota@notafile.com> | 2018-05-19 17:35:44 +0200 |
commit | dcc235b47d694d9ef7181b379d4e38bed2677028 (patch) | |
tree | dcfe8e9e6dcc1a0215dbdff5507c4de647f8bec9 /synapse/storage/_base.py | |
parent | fix py3 intern and remove unnecessary py3 encode (diff) | |
download | synapse-dcc235b47d694d9ef7181b379d4e38bed2677028.tar.xz |
use stand-in value if maxint is not available
Signed-off-by: Adrian Tschira <nota@notafile.com>
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index 2262776ab2..962cc270bc 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -30,6 +30,12 @@ import threading logger = logging.getLogger(__name__) +try: + MAX_TXN_ID = sys.maxint - 1 +except AttributeError: + # python 3 does not have a maximum int value + MAX_TXN_ID = 2**63 - 1 + sql_logger = logging.getLogger("synapse.storage.SQL") transaction_logger = logging.getLogger("synapse.storage.txn") perf_logger = logging.getLogger("synapse.storage.TIME") @@ -222,7 +228,7 @@ class SQLBaseStore(object): # We don't really need these to be unique, so lets stop it from # growing really large. - self._TXN_ID = (self._TXN_ID + 1) % (sys.maxint - 1) + self._TXN_ID = (self._TXN_ID + 1) % (MAX_TXN_ID) name = "%s-%x" % (desc, txn_id, ) |