follow-up to #1066: update redis to 5.0.0 which includes full fix for connection leak in from_url(), (#1081)
simplifies previous workaround addressed in 5.0.0
This commit is contained in:
parent
768d1181f8
commit
90b2f94aef
@ -13,8 +13,7 @@ from kubernetes_asyncio.client.api import custom_objects_api
|
|||||||
from kubernetes_asyncio.utils import create_from_dict
|
from kubernetes_asyncio.utils import create_from_dict
|
||||||
from kubernetes_asyncio.client.exceptions import ApiException
|
from kubernetes_asyncio.client.exceptions import ApiException
|
||||||
|
|
||||||
from redis.asyncio import Redis
|
from redis import asyncio as aioredis
|
||||||
from redis.asyncio.connection import ConnectionPool
|
|
||||||
|
|
||||||
from fastapi.templating import Jinja2Templates
|
from fastapi.templating import Jinja2Templates
|
||||||
from .utils import get_templates_dir, dt_now, to_k8s_date
|
from .utils import get_templates_dir, dt_now, to_k8s_date
|
||||||
@ -67,14 +66,9 @@ class K8sAPI:
|
|||||||
|
|
||||||
async def get_redis_client(self, redis_url):
|
async def get_redis_client(self, redis_url):
|
||||||
"""return redis client with correct params for one-time use"""
|
"""return redis client with correct params for one-time use"""
|
||||||
# manual settings until redis 5.0.0 is released
|
return aioredis.from_url(
|
||||||
pool = ConnectionPool.from_url(redis_url, decode_responses=True)
|
redis_url, decode_responses=True, auto_close_connection_pool=True
|
||||||
redis = Redis(
|
|
||||||
connection_pool=pool,
|
|
||||||
decode_responses=True,
|
|
||||||
)
|
)
|
||||||
redis.auto_close_connection_pool = True
|
|
||||||
return redis
|
|
||||||
|
|
||||||
# pylint: disable=too-many-arguments
|
# pylint: disable=too-many-arguments
|
||||||
async def new_crawl_job(
|
async def new_crawl_job(
|
||||||
|
@ -5,7 +5,7 @@ loguru
|
|||||||
aiofiles
|
aiofiles
|
||||||
kubernetes-asyncio==22.6.5
|
kubernetes-asyncio==22.6.5
|
||||||
aiobotocore
|
aiobotocore
|
||||||
redis>=5.0.0rc2
|
redis>=5.0.0
|
||||||
pyyaml
|
pyyaml
|
||||||
jinja2
|
jinja2
|
||||||
humanize
|
humanize
|
||||||
|
Loading…
Reference in New Issue
Block a user