Merge pull request #5376 from mstilkerich/fix_dockerapi_cpuload

Fix CPU load of dockerapi container
This commit is contained in:
Patrick Schult 2023-08-28 16:23:27 +02:00 committed by GitHub
commit 9ba5c13702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -198,8 +198,8 @@ async def handle_pubsub_messages(channel: aioredis.client.PubSub):
while True: while True:
try: try:
async with async_timeout.timeout(1): async with async_timeout.timeout(60):
message = await channel.get_message(ignore_subscribe_messages=True) message = await channel.get_message(ignore_subscribe_messages=True, timeout=30)
if message is not None: if message is not None:
# Parse message # Parse message
data_json = json.loads(message['data'].decode('utf-8')) data_json = json.loads(message['data'].decode('utf-8'))
@ -244,7 +244,7 @@ async def handle_pubsub_messages(channel: aioredis.client.PubSub):
else: else:
dockerapi.logger.error("Unknwon PubSub recieved - %s" % json.dumps(data_json)) dockerapi.logger.error("Unknwon PubSub recieved - %s" % json.dumps(data_json))
await asyncio.sleep(0.01) await asyncio.sleep(0.0)
except asyncio.TimeoutError: except asyncio.TimeoutError:
pass pass