""" This lambda clear push messages records excluding stored period. """ from redis import BlockingConnectionPool, StrictRedis from apollo_clear_notifications.config import config from apollo_clear_notifications.constants import APP_NAME, ENV_PROD from apollo_clear_notifications.handler import handler from apollo_clear_notifications.logger import get_logger redis_pool: BlockingConnectionPool or None = None def lambda_handler(event, context): logger = get_logger(context.aws_request_id) global redis_pool if not redis_pool: redis_pool = BlockingConnectionPool(host=config.REDIS_HOST, port=config.REDIS_PORT) redis_client = StrictRedis(connection_pool=redis_pool) return handler(logger, redis_client, config)