Skip to content
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

Merged
merged 4 commits into from
Oct 22, 2024
Merged

Fix redis connection #7956

merged 4 commits into from
Oct 22, 2024

Conversation

Weiko
Copy link
Member

@Weiko Weiko commented Oct 22, 2024

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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

@Weiko Weiko enabled auto-merge (squash) October 22, 2024 13:37
Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

LGTM!

@Weiko Weiko merged commit 02c34d5 into main Oct 22, 2024
18 checks passed
@Weiko Weiko deleted the c--fix-redis-connection branch October 22, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants