Skip to content
Open
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
2 changes: 1 addition & 1 deletion functions/memorystore/redis/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
functions-framework==3.9.2
redis==6.0.0
redis==7.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this update is fine for the Cloud Function environment, it's a good opportunity to address the use of a deprecated class. The redis.StrictRedis class used in functions/memorystore/redis/main.py is deprecated and should be replaced with redis.Redis to align with the library's current API and avoid future breakages.

This change should be applied in functions/memorystore/redis/main.py and its corresponding test file:

In functions/memorystore/redis/main.py (line 24):

- redis_client = redis.StrictRedis(host=redis_host, port=redis_port)
+ redis_client = redis.Redis(host=redis_host, port=redis_port)

In functions/memorystore/redis/main_test.py (line 27):

- @unittest.mock.patch("redis.StrictRedis")
+ @unittest.mock.patch("redis.Redis")

2 changes: 1 addition & 1 deletion memorystore/redis/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
# [START memorystore_requirements]
Flask==3.0.3
gunicorn==23.0.0
redis==6.0.0
redis==7.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This update to redis==7.0.0 has a critical side-effect and also highlights a needed code modernization.

1. Python Version Incompatibility (Critical):
redis-py>=6.0.0 requires Python 3.8+. The Dockerfile at memorystore/redis/gke_deployment/Dockerfile is configured to use Python 3.4. This will cause the Docker build to fail when installing dependencies. The Dockerfile needs to be updated to use a more recent Python version (3.8 or higher).

2. Deprecated StrictRedis class (Medium):
memorystore/redis/main.py uses the deprecated redis.StrictRedis class. This should be updated to redis.Redis.

In memorystore/redis/main.py (line 24):

- redis_client = redis.StrictRedis(host=redis_host, port=redis_port)
+ redis_client = redis.Redis(host=redis_host, port=redis_port)

Werkzeug==3.0.3
# [END memorystore_requirements]