Explanation of eventletreactor service_timeouts routine

This commit is contained in:
Adam Holmberg
2015-05-08 10:04:58 -05:00
parent ce15713f08
commit fab252154e

View File

@@ -16,7 +16,6 @@
# Originally derived from MagnetoDB source: # Originally derived from MagnetoDB source:
# https://github.com/stackforge/magnetodb/blob/2015.1.0b1/magnetodb/common/cassandra/io/eventletreactor.py # https://github.com/stackforge/magnetodb/blob/2015.1.0b1/magnetodb/common/cassandra/io/eventletreactor.py
from collections import defaultdict
from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, EINVAL from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, EINVAL
import eventlet import eventlet
from eventlet.green import select, socket from eventlet.green import select, socket
@@ -73,6 +72,12 @@ class EventletConnection(Connection):
@classmethod @classmethod
def service_timeouts(cls): def service_timeouts(cls):
"""
cls._timeout_watcher runs in this loop forever.
It is usually waiting for the next timeout on the cls._new_timer Event.
When new timers are added, that event is set so that the watcher can
wake up and possibly set an earlier timeout.
"""
timer_manager = cls._timers timer_manager = cls._timers
while True: while True:
next_end = timer_manager.service_timeouts() next_end = timer_manager.service_timeouts()