kopia lustrzana https://github.com/Yakifo/amqtt
clean code
rodzic
84dc9aa1c0
commit
86b66befb0
|
@ -19,8 +19,8 @@ _defaults = {
|
|||
'ping_delay': 1,
|
||||
'default_qos': 0,
|
||||
'default_retain': False,
|
||||
'inflight-polling-interval': 2,
|
||||
'subscriptions-polling-interval': 2,
|
||||
'inflight-polling-interval': 1,
|
||||
'subscriptions-polling-interval': 1,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -292,12 +292,11 @@ class ClientProtocolHandler(ProtocolHandler):
|
|||
if self._ping_task:
|
||||
try:
|
||||
self._ping_task.cancel()
|
||||
self.logger.debug('Cancel pending ping')
|
||||
except Exception:
|
||||
pass
|
||||
next_ping = self.session.keep_alive - self.config['ping_delay']
|
||||
if next_ping > 0:
|
||||
self.logger.debug('Next ping in %d seconds' % next_ping)
|
||||
self.logger.debug('Next ping in %d seconds if no new messages between' % next_ping)
|
||||
self._ping_task = self._loop.call_later(next_ping, asyncio.async, self.mqtt_ping())
|
||||
|
||||
def _subscriptions_coro(self):
|
||||
|
|
|
@ -9,7 +9,6 @@ C = MQTTClient()
|
|||
@asyncio.coroutine
|
||||
def test_coro():
|
||||
yield from C.connect(uri='mqtt://iot.eclipse.org:1883/', username='testuser', password="passwd")
|
||||
yield from asyncio.sleep(1)
|
||||
tasks = [
|
||||
asyncio.async(C.publish('a/b', b'0123456789')),
|
||||
asyncio.async(C.publish('a/b', b'0', qos=0x01)),
|
||||
|
|
Ładowanie…
Reference in New Issue