""" This lambda invokes when file is created on S3 and it executes batch further batch processing. """ from typing import Optional from redis import BlockingConnectionPool, StrictRedis from send_push_notifications.config import Config from send_push_notifications.handler import handler from send_push_notifications.logger import get_logger redis_pool: Optional[BlockingConnectionPool] = None def lambda_handler(event, context): logger = get_logger(context.aws_request_id) config = Config() 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) handler(logger, event, redis_client) return {}