tensor/service.py
def sourceWatchdog(self):
        """Watchdog timer function. 

        Recreates sources which have not generated events in 10*interval if
        they have watchdog set to true in their configuration
        """
        for i, source in enumerate(self.sources):
            if not source.config.get('watchdog', False):
                continue 
            sn = repr(source)
            last = self.lastEvents.get(source, None)
            if last:
                try:
                    if last < (time.time()-(source.inter*10)):
                        log.msg("Trying to restart stale source %s: %ss" % (
                            sn, int(time.time() - last)
                        ))

                        s = self.sources.pop(i)
                        try:
                            s.t.stop()
                        except Exception as e:
                            log.msg("Could not stop timer for %s: %s" % (
                                sn, e))

                        config = copy.deepcopy(s.config)

                        del self.lastEvents[source]
                        del s, source

                        source = self.createSource(config)

                        reactor.callLater(0, self._startSource, source)
                except Exception as e:
                    log.msg("Could not reset source %s: %s" % (
                        sn, e))
def sourceWatchdog(self):
        for i, source in enumerate(self.sources):
            if not source.config.get('watchdog', False):
                continue 
            sn = repr(source)
            last = self.lastEvents.get(source, None)
            if last:
                try:
                    if last < (time.time()-(source.inter*10)):
                        log.msg("Trying to restart stale source %s: %ss" % (
                            sn, int(time.time() - last)
                        ))

                        s = self.sources.pop(i)
                        try:
                            s.t.stop()
                        except Exception as e:
                            log.msg("Could not stop timer for %s: %s" % (
                                sn, e))

                        config = copy.deepcopy(s.config)

                        del self.lastEvents[source]
                        del s, source

                        source = self.createSource(config)

                        reactor.callLater(0, self._startSource, source)
                except Exception as e:
                    log.msg("Could not reset source %s: %s" % (
                        sn, e))
def sourceWatchdog ( self ) : for i , source in enumerate ( self . sources ) : if not source . config . get ( 'watchdog' , False ) : continue sn = repr ( source ) last = self . lastEvents . get ( source , None ) if last : try : if last < ( time . time ( ) - ( source . inter * 10 ) ) : log . msg ( "Trying to restart stale source %s: %ss" % ( sn , int ( time . time ( ) - last ) ) ) s = self . sources . pop ( i ) try : s . t . stop ( ) except Exception as e : log . msg ( "Could not stop timer for %s: %s" % ( sn , e ) ) config = copy . deepcopy ( s . config ) del self . lastEvents [ source ] del s , source source = self . createSource ( config ) reactor . callLater ( 0 , self . _startSource , source ) except Exception as e : log . msg ( "Could not reset source %s: %s" % ( sn , e ) )
Watchdog timer function. 

        Recreates sources which have not generated events in 10*interval if
        they have watchdog set to true in their configuration
Watchdog timer function .