def __flusher(self): """Yield strings. We unload bytestrings as fast as we can until we run out of time or bytestrings. On my MacBook Pro I am seeing between 500 and 1000 messages dumped in 2ms--without any WSGI/HTTP/TCP overhead. We always yield at least one bytestring to avoid deadlock. This generator is instantiated in self.flush. """ if self.queue: yield packet.frame(self.get()) timeout = time.time() + (0.007) # We have 7ms to dump bytestrings. Go! while self.queue and time.time() < timeout: yield packet.frame(self.get())
def __flusher(self): """Yield strings. We unload bytestrings as fast as we can until we run out of time or bytestrings. On my MacBook Pro I am seeing between 500 and 1000 messages dumped in 2ms--without any WSGI/HTTP/TCP overhead. We always yield at least one bytestring to avoid deadlock. This generator is instantiated in self.flush. """ if not self.empty(): yield packet.frame(self.get()) timeout = time.time() + (0.007) # We have 7ms to dump bytestrings. Go! while not self.empty() and time.time() < timeout: yield packet.frame(self.get())