(self, poll_interval=0.5)
Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds. Ignores
        self.timeout. If you need to do periodic tasks, do them in
        another thread.
Handle one request at a time until shutdown.
Handle one request at a time until shutdown .
def serve_forever(self, poll_interval=0.5):
        """Handle one request at a time until shutdown.

        Polls for shutdown every poll_interval seconds. Ignores
        self.timeout. If you need to do periodic tasks, do them in
        another thread.
        """
        self.__is_shut_down.clear()
        try:
            # XXX: Consider using another file descriptor or connecting to the
            # socket to wake this up instead of polling. Polling reduces our
            # responsiveness to a shutdown request and wastes cpu at all other
            # times.
            with _ServerSelector() as selector:
                selector.register(self, selectors.EVENT_READ)

                while not self.__shutdown_request:
                    ready = selector.select(poll_interval)
                    # bpo-35017: shutdown() called during select(), exit immediately.
                    if self.__shutdown_request:
                        break
                    if ready:
                        self._handle_request_noblock()

                    self.service_actions()
        finally:
            self.__shutdown_request = False
            self.__is_shut_down.set()
def serve_forever ( self , poll_interval = 0.5 ) : self . __is_shut_down . clear ( ) try : # XXX: Consider using another file descriptor or connecting to the # socket to wake this up instead of polling. Polling reduces our # responsiveness to a shutdown request and wastes cpu at all other # times. with _ServerSelector ( ) as selector : selector . register ( self , selectors . EVENT_READ ) while not self . __shutdown_request : ready = selector . select ( poll_interval ) # bpo-35017: shutdown() called during select(), exit immediately. if self . __shutdown_request : break if ready : self . _handle_request_noblock ( ) self . service_actions ( ) finally : self . __shutdown_request = False self . __is_shut_down . set ( )