-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix redis connection #7956
Fix redis connection #7956
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This pull request addresses Redis connection issues in the cache storage and message queue modules, improving reliability and consistency.
- Replaced 'url' parameter with 'client' in
cache-storage.module-factory.ts
, using an IORedis client for better connection handling - Updated BullMQ connection in
message-queue.module-factory.ts
to use IORedis, fixing the issue of ignored connection parameters - Aligned both modules with BullMQ documentation, ensuring correct utilization of connection parameters
- Improved error handling for missing REDIS_URL in both modules
- Standardized Redis connection approach across cache storage and message queue modules for better maintainability
2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Context
bull-mq connection was not working as intended, the connection parameter was ignored and was falling back to localhost.
This PR should fix the issue by instantiating a IORedis client following bullmq documentation https://docs.bullmq.io/guide/connections
I also changed cache-storage module to use IORedis client as well to be more consistent even though it was not necessary there. We could move that instantiation to a factory class in the future.
Test
start server + worker with correct port and wrong port with cache-storage-type memory/redis and queue-type sync/bull-mq