mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 15:35:55 +03:00
[PR #953] [CLOSED] Add NewClientWithExistingRedisClient to create a client with an existing Redis connection #1953
Labels
No labels
CLI
bug
designing
documentation
duplicate
enhancement
good first issue
good first issue
help wanted
idea
invalid
investigate
needs-more-info
performance
pr-welcome
pull-request
question
wontfix
work in progress
work in progress
work-around-available
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asynq#1953
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hibiken/asynq/pull/953
Author: @sanudatta11
Created: 10/31/2024
Status: ❌ Closed
Base:
master← Head:feature/use-redis-connection📝 Commits (1)
58b2c2cAdded Code for reusing Redis Connection📊 Changes
2 files changed (+35 additions, -0 deletions)
View changed files
📝
client.go(+10 -0)📝
client_test.go(+25 -0)📄 Description
PR Description
This PR introduces a new function NewClientWithExistingRedisClient to the Client struct. This function allows the creation of a Client instance using an already established redis.UniversalClient.
Changes:
Added NewClientWithExistingRedisClient function.
New Function Pings the provided Redis client to ensure connectivity.
Creates a new Client instance using the existing Redis client.
Sets the sharedConnection flag to false to indicate that the connection should not be closed by the Client.
This enhancement is useful for scenarios where the Redis connection is managed externally and should not be closed by the Client.
I personally had a project usecase where I didn't want to pass the username password as I wanted to reuse the existing redis client and thus made this addtion.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.