kubernetes_asyncio icon indicating copy to clipboard operation
kubernetes_asyncio copied to clipboard

watch stream set timeout_seconds=0 not work

Open flyhighzy opened this issue 5 years ago • 0 comments

as example code:

    async def watch_job_event(namespace: str, callback: asyncio.coroutines):
        """ watch job event"""
        async with ApiClient() as api:
            batchv1 = client.BatchV1Api(api)
            w = watch.Watch()
            logging.info("begin to watch job events")
            async with w.stream(batchv1.list_namespaced_job, namespace, timeout_seconds=0) as stream:
                async for event in stream:
                    evt, obj = event['type'], event['object']
                    try:
                        await callback(evt, obj)
                    except Exception as e:
                        import traceback
                        logging.error(f"watch job event callback get exception: {traceback.format_exc()}")

As I set timeout_seconds=0 here, expect no timeout, but got aiohttp's TimeoutError after 5 minutes. I check the code and find in watch.py line 147, when got asyncio.TimeoutError, only when "timeout_seconds" not in func's keywords can continue, I'm expecting to have the same behavior when set timeout_seconds=0. :)

flyhighzy avatar Jul 23 '20 12:07 flyhighzy