Example #1
0
 def run(r=None):
     if w.total > 1000:
         reactor.stop()
         return
     w.total += 1
     df = launch_coroutine(wrap_task(reactor.callLater), w.do_some_things)
     df.addCallback(run)
     df.addErrback(set_event_error)
Example #2
0
 def run(r=None):
     if w.total > 1000:
         reactor.stop()
         return
     w.total += 1
     df = launch_coroutine(wrap_task(reactor.callLater),
                           w.do_some_things)
     df.addCallback(run)
     df.addErrback(set_event_error)
Example #3
0
 def test_rate_limited_logger():
     injectLogger(verbose = True)
     log = RateLimitedLogger(logging.getLogger("myapp"), 1,1)
     log.info( "should be printed." )
     log.info( "should not be printed" )  # but should log "discard" message.
     log.info( "also should not be printed" )  # should not logging of discard message.
     df = Deferred()
     reactor.callLater(3, df.callback, True)
     like_yield(df)
     log.info( "should also be printed" )
     reactor.stop()
Example #4
0
 def test_rate_limited_logger():
     injectLogger(verbose = True)
     log = RateLimitedLogger(logging.getLogger("myapp"), 1,1)
     log.info( "should be printed." )
     log.info( "should not be printed" )  # but should log "discard" message.
     log.info( "also should not be printed" )  # should not logging of discard message.
     df = Deferred()
     reactor.callLater(3, df.callback, True)
     like_yield(df)
     log.info( "should also be printed" )
     reactor.stop()
Example #5
0
    def _stop(self, r=None):
        assert thread.get_ident() == self.ident

        connections = list(self.single_sockets)
        for connection in connections:
            try:
                connection.close()
            except:
                pass

        reactor.suggestThreadPoolSize(0)
        try:
            reactor.stop()
        except RuntimeError:
            # exceptions.RuntimeError: can't stop reactor that isn't running
            pass
Example #6
0
    def _stop(self, r=None):
        assert thread.get_ident() == self.ident

        connections = list(self.single_sockets)
        for connection in connections:
            try:
                connection.close()
            except:
                pass

        reactor.suggestThreadPoolSize(0)
        try:
            reactor.stop()
        except RuntimeError:
            # exceptions.RuntimeError: can't stop reactor that isn't running
            pass
Example #7
0
 def foo():
     reactor.stop()
     zuul = dana
Example #8
0
 def set_event_error(x):
     print "A critical error occured:", str(x[0]), ":", str(x[1])
     reactor.stop()
Example #9
0
 def set_event(x):
     w.total -= 1
     assert w.total >= 0
     if w.total == 0:
         reactor.stop()
Example #10
0
 def set_event(x):
     w.total -= 1
     assert w.total >= 0
     if w.total == 0:
         reactor.stop()
Example #11
0
 def set_event_error(x):
     print "A critical error occured:", str(x[0]), ":", str(x[1])
     reactor.stop()
Example #12
0
 def foo():
     reactor.stop()
     zuul = dana