Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions import-automation/workflow/ingestion-helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,5 +289,23 @@
except Exception as e:
return (f"Aggregation failed: {str(e)}", 500)

elif action_type == 'clear_redis_cache':
Comment thread
gmechali marked this conversation as resolved.
logging.info("Action: clear_redis_cache")
redis_host = os.environ.get("REDIS_HOST")
redis_port = os.environ.get("REDIS_PORT", "6379")
if redis_host:
try:
import redis
r = redis.Redis(host=redis_host, port=int(redis_port))
r.flushall(asynchronous=True)
Comment thread
gmechali marked this conversation as resolved.
logging.info(f"Redis cache at {redis_host}:{redis_port} flushed successfully (async).")
return jsonify({'status': 'SUCCESS', 'message': 'Cache cleared'}), 200
except Exception as e:
logging.error(f"Failed to flush Redis cache: {e}")
return jsonify({'status': 'ERROR', 'message': str(e)}), 500

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
Comment thread
gmechali marked this conversation as resolved.
Dismissed
else:
logging.warning("REDIS_HOST not set, skipping cache flush.")
return jsonify({'status': 'SKIPPED', 'message': 'REDIS_HOST not set'}), 200

else:
return (f'Unknown actionType: {action_type}', 400)
1 change: 1 addition & 0 deletions import-automation/workflow/ingestion-helper/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies = [
"google-auth",
"absl-py",
"google-cloud-bigquery",
"redis",
]

[tool.hatch.build.targets.wheel]
Expand Down
Loading