mirror of
https://github.com/hibiken/asynq.git
synced 2026-04-26 15:35:55 +03:00
[GH-ISSUE #103] [FEATURE REQUEST] Add a function to create RedisConnOpt from a URL #2051
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#2051
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?
Originally created by @rugwirobaker on GitHub (Mar 5, 2020).
Original GitHub issue: https://github.com/hibiken/asynq/issues/103
I like how unlike most
redisbackedtask queuesyou have abstracted away connection pooling so I don't have to think about which client to connect with. However I had to write my ownredis ParseURLfunction cause it was bit annoying passing multiple configuration values for just one resource while I pass just one for all the others.Describe the solution you'd like
Though it's trivial it would be really great to have one provided by the package.
that would be of the following signature:
Describe alternatives you've considered
I wrote my own.
Additional context
The task is simple enough I could open a PR if you approve
@hibiken commented on GitHub (Mar 5, 2020):
@rugwirobaker Thanks for opening this issue!
I think having a function to create a
RedisConnOptfrom a URL is valuable.Would you mind explaining the pain points in more detail just so that I understand it better? What was annoying? I'm guessing you had access to a Redis URL and had to parse it every time you need to instantiate
asynq.Clientorasynq.Background?For the specification of the function, let's create a function with this signature:
Note:
RedisConnOptis a union ofRedisClientOptandRedisFailoverClientOpt. The former is used connecting directly to Redis and the latter is used to connecting to Redis using Sentinel.For the URL scheme I found this page (let's follow this scheme to support different mode)
I'm excited to get contributions from the community, so please feel free to open a PR!
@rugwirobaker commented on GitHub (Mar 9, 2020):
Hey, I have noticed that the redis client you are using already has it's own parser. Wouldn't be a good idea to just use that and build from there?
@hibiken commented on GitHub (Mar 9, 2020):
I see. Redis#ParseURL returns Options which we can use for
RedisClientOpt. But we also want to supportRedisFailoverClientOptwhich needs FailoverOptions From the redis package. Maybe we could look at their implementations as a reference? And I suppose we could use Redis#ParseURL to handle URLs for basic cases.@hibiken commented on GitHub (Mar 15, 2020):
@rugwirobaker I'm assigning this issue to you for now, but feel free to assign it back to me if you don't have enough bandwidth to work on this in the next few weeks 👍