impl StreamRouter { fn event_loop( mut conn: redis::connection::Connection, tx: loole::Sender<StreamReadTask>, rx: loole::Receiver<StreamReadTask>, alive: Arc<AtomicBool>, options: StreamReadOptions, count: usize, ) -> RedisResult<()> { let mut stream_keys = Vec::with_capacity(count); let mut message_ids = Vec::with_capacity(count); let mut senders = HashMap::with_capacity(count); while alive.load(SeqCst) { // read as many tasks as possible without blocking more than once if !Self::read_buf(&rx, &mut stream_keys, &mut message_ids, &mut senders) { break; // pending task queue has been closed } // read_buf should always return non-empty buffer assert!