pub fn run(&mut self) {
        let mut events = Events::with_capacity(self.nevent);

        loop {
            WORKER_EVENT_LOOP.increment();

            self.storage.expire();

            // get events with timeout
            if self.poll.poll(&mut events, self.timeout).is_err() {
                error!("Error polling");
            }

            WORKER_EVENT_TOTAL.add(events.iter().count() as _);

            common::time::refresh_clock();

            // process all events
            for event in events.iter() {
                match event.token() {
                    WAKER_TOKEN => {
                        self.handle_new_sessions();

                        // check if we received any signals from the admin thread
                        while let Ok(signal) = self.signal_queue.try_recv() {
                            match signal.into_inner() {
                                Signal::FlushAll => {
                                    warn!("received flush_all");
                                    self.storage.clear();
                                }
                                Signal::Shutdown => {
                                    // if we received a shutdown, we can return
                                    // and stop processing events
                                    return;
                                }
                            }
                        }
                    }
                    _ => {
                        self.handle_event(event);
                    }
                }
            }
        }
    }
/// Run the worker in a loop, handling new events.
Run the worker in a loop, handling new events.
Run the worker in a loop handling new events .
pub fn run(&mut self) {
        let mut events = Events::with_capacity(self.nevent);
        loop {
            WORKER_EVENT_LOOP.increment();
            self.storage.expire();
            // get events with timeout
            if self.poll.poll(&mut events, self.timeout).is_err() {
                error!("Error polling");
            }
            WORKER_EVENT_TOTAL.add(events.iter().count() as _);
            common::time::refresh_clock();
            // process all events
            for event in events.iter() {
                match event.token() {
                    WAKER_TOKEN => {
                        self.handle_new_sessions();
                        // check if we received any signals from the admin thread
                        while let Ok(signal) = self.signal_queue.try_recv() {
                            match signal.into_inner() {
                                Signal::FlushAll => {
                                    warn!("received flush_all");
                                    self.storage.clear();
                                }
                                Signal::Shutdown => {
                                    // if we received a shutdown, we can return
                                    // and stop processing events
                                    return;
                                }
                            }
                        }
                    }
                    _ => {
                        self.handle_event(event);
                    }
                }
            }
        }
    }
pub fn run ( & mut self ) { let mut events = Events :: with_capacity ( self . nevent ) ; loop { WORKER_EVENT_LOOP . increment ( ) ; self . storage . expire ( ) ; // get events with timeout if self . poll . poll ( & mut events , self . timeout ) . is_err ( ) { error ! ( " " ) ; } WORKER_EVENT_TOTAL . add ( events . iter ( ) . count ( ) as _ ) ; common :: time :: refresh_clock ( ) ; // process all events for event in events . iter ( ) { match event . token ( ) { WAKER_TOKEN => { self . handle_new_sessions ( ) ; // check if we received any signals from the admin thread while let Ok ( signal ) = self . signal_queue . try_recv ( ) { match signal . into_inner ( ) { Signal :: FlushAll => { warn ! ( " " ) ; self . storage . clear ( ) ; } Signal :: Shutdown => { // if we received a shutdown, we can return // and stop processing events return ; } } } } _ => { self . handle_event ( event ) ; } } } } }
Run the worker in a loop, handling new events.
Run the worker in a loop handling new events .
&mut self
&mut self