Changeset - 9e7500543ab6
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-30 02:33:16
drewp@bigasterisk.com
take out retries
1 file changed with 0 insertions and 10 deletions:
0 comments (0 inline, 0 general)
light9/collector/collector_client_asyncio.py
Show inline comments
 
import logging
 
import tenacity
 
from light9 import networking
 
from light9.collector.collector_client import toCollectorJson
 
from light9.effect.settings import DeviceSettings
 
@@ -20,13 +19,7 @@ class _Sender:
 
    async def send(self, client: str, session: str, settings: DeviceSettings):
 
        msg = toCollectorJson(client, session, settings).encode('utf8')
 

	
 
        @tenacity.retry(
 
            retry=tenacity.retry_if_exception_type(aiohttp.ServerTimeoutError),
 
            reraise=True, 
 
            stop=tenacity.stop_after_attempt(3),
 
            )
 
        async def put():
 

	
 
            async with self.http_session.put(networking.collector.path('attrs'), data=msg, timeout=.2) as resp:
 
                if resp.status != 202:
 
                    body = await resp.text()
 
@@ -34,9 +27,6 @@ class _Sender:
 
                    raise ValueError(f'collector returned {resp.status}: {body}')
 

	
 
        await put()
 
        attempts = put.retry.statistics['attempt_number']
 
        if attempts!=1:
 
            log.warning(f"{attempts=}")
 

	
 

	
 
_sender = _Sender()
0 comments (0 inline, 0 general)