platypush/backend/__init__.py
def run(self):
        """ Starts the backend thread. To be implemented in the derived classes if the loop method isn't defined. """
        self.thread_id = get_ident()
        set_thread_name(self._thread_name)
        if not callable(self.loop):
            return

        while not self.should_stop():
            try:
                with self:
                    has_error = False

                    while not self.should_stop() and not has_error:
                        try:
                            self.loop()
                        except Exception as e:
                            has_error = True
                            self.logger.error(str(e))
                            self.logger.exception(e)
                        finally:
                            if self.poll_seconds:
                                time.sleep(self.poll_seconds)
                            elif has_error:
                                time.sleep(5)
            except Exception as e:
                self.logger.error('{} initialization error: {}'.format(self.__class__.__name__, str(e)))
                self.logger.exception(e)
                time.sleep(self.poll_seconds or 5)
 Starts the backend thread. To be implemented in the derived classes if the loop method isn't defined. 
Starts the backend thread. To be implemented in the derived classes if the loop method isn't defined.
Starts the backend thread . To be implemented in the derived classes if the loop method isn ' t defined .
def run(self):
        self.thread_id = get_ident()
        set_thread_name(self._thread_name)
        if not callable(self.loop):
            return
        while not self.should_stop():
            try:
                with self:
                    has_error = False
                    while not self.should_stop() and not has_error:
                        try:
                            self.loop()
                        except Exception as e:
                            has_error = True
                            self.logger.error(str(e))
                            self.logger.exception(e)
                        finally:
                            if self.poll_seconds:
                                time.sleep(self.poll_seconds)
                            elif has_error:
                                time.sleep(5)
            except Exception as e:
                self.logger.error('{} initialization error: {}'.format(self.__class__.__name__, str(e)))
                self.logger.exception(e)
                time.sleep(self.poll_seconds or 5)
def run ( self ) : self . thread_id = get_ident ( ) set_thread_name ( self . _thread_name ) if not callable ( self . loop ) : return while not self . should_stop ( ) : try : with self : has_error = False while not self . should_stop ( ) and not has_error : try : self . loop ( ) except Exception as e : has_error = True self . logger . error ( str ( e ) ) self . logger . exception ( e ) finally : if self . poll_seconds : time . sleep ( self . poll_seconds ) elif has_error : time . sleep ( 5 ) except Exception as e : self . logger . error ( '{} initialization error: {}' . format ( self . __class__ . __name__ , str ( e ) ) ) self . logger . exception ( e ) time . sleep ( self . poll_seconds or 5 )
Starts the backend thread.
Starts the backend thread .
""" Starts the backend thread. To be implemented in the derived classes if the loop method isn't defined. """
self