]> git.ipfire.org Git - thirdparty/tornado.git/commit
ioloop.py: use itertools.count() as tiebreaker to preserve FIFO in case of tie 1069/head
authordrewbrew <drewbrew@users.noreply.github.com>
Tue, 3 Jun 2014 18:22:08 +0000 (13:22 -0500)
committerdrewbrew <drewbrew@users.noreply.github.com>
Tue, 3 Jun 2014 20:14:46 +0000 (15:14 -0500)
commit5fc96e6fd4184828445a73a2a3befac04a2a53f4
treecc179b0eb054157fe970b692e0224b2ebd4f850a
parent53e4bad98d66e8699253dfbd169f073e5c401676
ioloop.py: use itertools.count() as tiebreaker to preserve FIFO in case of tie

Current implementation does not function as a FIFO.  When adding multiple
timeouts with the same deadline, order is currently consistently mangled in the
event of a garbage collect.

As suggested by Ben Darnell at
https://groups.google.com/forum/#!topic/python-tornado/w8aKm6ZabUQ/discussion,
we need to add a sequence number to the Timeout class to serve as tiebreaker.
This code uses the model suggested by
https://docs.python.org/2/library/heapq.html#priority-queue-implementation-notes,
which uses itertools.count() to serve as our counter.
tornado/ioloop.py