mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-20 22:34:17 -05:00
Also remove yield from within lock in the other generator
This commit is contained in:
parent
d2d61a8288
commit
50f96f256f
@ -30,15 +30,13 @@ class IdGenerator(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_next(self):
|
def get_next(self):
|
||||||
with self._lock:
|
if self._next_id is None:
|
||||||
if not self._next_id:
|
yield self.store.runInteraction(
|
||||||
res = yield self.store._execute_and_decode(
|
|
||||||
"IdGenerator_%s" % (self.table,),
|
"IdGenerator_%s" % (self.table,),
|
||||||
"SELECT MAX(%s) as mx FROM %s" % (self.column, self.table,)
|
self.get_next_txn,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._next_id = (res and res[0] and res[0]["mx"]) or 1
|
with self._lock:
|
||||||
|
|
||||||
i = self._next_id
|
i = self._next_id
|
||||||
self._next_id += 1
|
self._next_id += 1
|
||||||
defer.returnValue(i)
|
defer.returnValue(i)
|
||||||
|
Loading…
Reference in New Issue
Block a user