How to use the twisted.internet.reactor.callLater function in Twisted

To help you get started, we’ve selected a few Twisted examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla-services / autopush-loadtester / aplt / runner.py View on Github external
scenario,
                self._endpoint,
                self._endpoint_ssl_cert,
                self._endpoint_ssl_key,
                *scenario_args[0],
                **scenario_args[1]
            )
            self._harnesses.append(harness)
            iterations = quantity / stagger
            for delay in range(iterations):
                def runall():
                    for _ in range(stagger):
                        harness.run()
                    self._queued_calls -= 1
                self._queued_calls += 1
                reactor.callLater(overall_delay+delay, runall)
github JoinMarket-Org / joinmarket-clientserver / jmdaemon / jmdaemon / irc.py View on Github external
def topicUpdated(self, user, channel, newTopic):
        wlog('topicUpdated: ', user, channel, newTopic)
        if self.wrapper.on_set_topic:
            reactor.callLater(0.0, self.wrapper.on_set_topic, newTopic)
github BTrDB / btrdb-server / py / qdf / qdf.py View on Github external
    @defer.inlineCallbacks
    def _start(self):
        yield self._nuke_old_streams()
        reactor.callLater(1, self._cycle)
github spladug / harold / harold / plugins / alerts.py View on Github external
def _register_quiet(self, sender, duration):
        quiet = Quiet()
        quiet.user = make_short_name(sender)
        quiet.expirator = reactor.callLater(
            duration,
            self._deregister_quiet,
            sender
        )
        quiet.expiration = (datetime.datetime.now() +
                            datetime.timedelta(seconds=duration))
        self.quiets[sender] = quiet
github twisted / twisted / docs / core / examples / wxacceptance.py View on Github external
def shutdown():
    print "shutting down in 3 seconds"
    if dc.active():
        dc.cancel()
    reactor.callLater(1, printer, "2...")
    reactor.callLater(2, printer, "1...")
    reactor.callLater(3, printer, "0...")
    d = defer.Deferred()
    reactor.callLater(3, d.callback, 1)
    return d
github twisted / twisted / src / twisted / words / protocols / irc.py View on Github external
def _sendLine(self):
        if self._queue:
            self._reallySendLine(self._queue.pop(0))
            self._queueEmptying = reactor.callLater(self.lineRate,
                                                    self._sendLine)
        else:
            self._queueEmptying = None
github Kitware / VTK / ThirdParty / Twisted / twisted / protocols / policies.py View on Github external
def callLater(self, period, func):
        """
        Wrapper around L{reactor.callLater} for test purpose.
        """
        from twisted.internet import reactor
        return reactor.callLater(period, func)
github twisted / imaginary / ExampleGame / examplegame / mice.py View on Github external
def activate(self):
        from twisted.internet import reactor
        self._callLater = reactor.callLater
github crossbario / autobahn-python / examples / twisted / websocket / echo_compressed / client.py View on Github external
def onMessage(self, payload, isBinary):
        if not isBinary:
            print("Text message received: {}".format(payload.decode('utf8')))
        reactor.callLater(1, self.sendHello)
github opencord / voltha / voltha / adapters / openolt / openolt_flow_mgr.py View on Github external
for f in flows:
            if f.table_id == table_id:
                # FIXME
                if fd.get_in_port(f) == fd.get_in_port(flow) and \
                        fd.get_out_port(f) == port:
                    next_flows.append(f)

        if len(next_flows) == 0:
            self.log.warning('no next flow found, it may be a timing issue',
                             flow=flow, number_of_flows=len(flows))
            if flow.id in self.retry_add_flow_list:
                self.log.debug('flow is already in retry list',
                               flow_id=flow.id)
            else:
                self.retry_add_flow_list.append(flow.id)
                reactor.callLater(5, self.retry_add_flow, flow)
            return None

        next_flows.sort(key=lambda f: f.priority, reverse=True)

        return next_flows[0]