mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 01:34:48 -04:00
parent
2a1470cd05
commit
864f144543
22 changed files with 104 additions and 40 deletions
|
@ -13,9 +13,11 @@
|
|||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
import logging
|
||||
from contextlib import contextmanager
|
||||
from typing import Dict, Sequence, Set, Union
|
||||
|
||||
from six.moves import range
|
||||
|
||||
|
@ -213,7 +215,9 @@ class Linearizer(object):
|
|||
# the first element is the number of things executing, and
|
||||
# the second element is an OrderedDict, where the keys are deferreds for the
|
||||
# things blocked from executing.
|
||||
self.key_to_defer = {}
|
||||
self.key_to_defer = (
|
||||
{}
|
||||
) # type: Dict[str, Sequence[Union[int, Dict[defer.Deferred, int]]]]
|
||||
|
||||
def queue(self, key):
|
||||
# we avoid doing defer.inlineCallbacks here, so that cancellation works correctly.
|
||||
|
@ -340,10 +344,10 @@ class ReadWriteLock(object):
|
|||
|
||||
def __init__(self):
|
||||
# Latest readers queued
|
||||
self.key_to_current_readers = {}
|
||||
self.key_to_current_readers = {} # type: Dict[str, Set[defer.Deferred]]
|
||||
|
||||
# Latest writer queued
|
||||
self.key_to_current_writer = {}
|
||||
self.key_to_current_writer = {} # type: Dict[str, defer.Deferred]
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def read(self, key):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue