Merge pull request #3110 from NotAFile/py3-six-queue

Replace Queue with six.moves.queue
This commit is contained in:
Richard van der Hoff 2018-04-20 15:35:00 +01:00 committed by GitHub
commit c09a6daf09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View File

@ -25,7 +25,9 @@ from synapse.util.caches.descriptors import cached
from unpaddedbase64 import encode_base64 from unpaddedbase64 import encode_base64
import logging import logging
from Queue import PriorityQueue, Empty from six.moves.queue import PriorityQueue, Empty
from six.moves import range
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -79,7 +81,7 @@ class EventFederationWorkerStore(EventsWorkerStore, SignatureWorkerStore,
front_list = list(front) front_list = list(front)
chunks = [ chunks = [
front_list[x:x + 100] front_list[x:x + 100]
for x in xrange(0, len(front), 100) for x in range(0, len(front), 100)
] ]
for chunk in chunks: for chunk in chunks:
txn.execute( txn.execute(

View File

@ -17,7 +17,7 @@ from twisted.internet import threads, reactor
from synapse.util.logcontext import make_deferred_yieldable, preserve_fn from synapse.util.logcontext import make_deferred_yieldable, preserve_fn
import Queue from six.moves import queue
class BackgroundFileConsumer(object): class BackgroundFileConsumer(object):
@ -49,7 +49,7 @@ class BackgroundFileConsumer(object):
# Queue of slices of bytes to be written. When producer calls # Queue of slices of bytes to be written. When producer calls
# unregister a final None is sent. # unregister a final None is sent.
self._bytes_queue = Queue.Queue() self._bytes_queue = queue.Queue()
# Deferred that is resolved when finished writing # Deferred that is resolved when finished writing
self._finished_deferred = None self._finished_deferred = None