"""Lambda reindex-product-metadata function module.""" import sentry_sdk from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration from src import config from src.logic import event_handling if config.SENTRY_DSN: sentry_sdk.init( dsn=config.SENTRY_DSN, environment=config.ENVIRONMENT, integrations=[AwsLambdaIntegration(timeout_warning=True)] ) def handler(event, context): """Lambda Entry point.""" config.app_logger.debug(event) try: clear_index = event.get('clear_index', True) update_products = event.get('update_products', False) event_handling.processing_logic(clear_index, update_products) except Exception as e: config.app_logger.error(str(e)) raise e return {'status': 'success'}