mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-05 22:28:54 +01:00
use stand-in value if maxint is not available
Signed-off-by: Adrian Tschira <nota@notafile.com>
This commit is contained in:
parent
73cbdef5f7
commit
dcc235b47d
1 changed files with 7 additions and 1 deletions
|
@ -30,6 +30,12 @@ import threading
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
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")
|
sql_logger = logging.getLogger("synapse.storage.SQL")
|
||||||
transaction_logger = logging.getLogger("synapse.storage.txn")
|
transaction_logger = logging.getLogger("synapse.storage.txn")
|
||||||
perf_logger = logging.getLogger("synapse.storage.TIME")
|
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
|
# We don't really need these to be unique, so lets stop it from
|
||||||
# growing really large.
|
# 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, )
|
name = "%s-%x" % (desc, txn_id, )
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue