tpitale / mail_room

Forward mail from gmail IMAP to a callback URL or job worker, simply.
MIT License
193 stars 51 forks source link

Fix database in redis url #130

Closed jarkaK closed 2 years ago

jarkaK commented 2 years ago

This MR fixes Redis connection. When a db is specified in a url, it is correctly set in client but not connection.

Example:

redis = Redis.new(url: 'redis://localhost?db=4')

redis.client.options[:url]
=> "redis://localhost?db=4" # this is correct

 redis.connection
=> {:host=>"localhost", :port=>6379, :db=>0, :id=>"redis://localhost:6379/0", :location=>"localhost:6379"} # db here is incorrect

When the db is passed as a separated option, it works:

redis = Redis.new(url: 'redis://localhost?db=4', db: 4)

redis.client.options[:url]
=> "redis://localhost?db=4"

redis.connection
=> {:host=>"localhost", :port=>6379, :db=>4, :id=>"redis://localhost:6379/4", :location=>"localhost:6379"}
tpitale commented 2 years ago

@jarkaK Thanks for the PR. Would you mind getting one other person from GitLab to leave a review? Not sure if @DouweM is still there.

jarkaK commented 2 years ago

@tpitale I have first opened an MR with this change on GitLab, which has been reviewed by @smcgivern. I suppose he can approve here, too.

tpitale commented 2 years ago

@jarkaK Good enough for me. Sorry, didn't realize what an "MR" was.

tpitale commented 2 years ago

@jarkaK Do you need a version released?

smcgivern commented 2 years ago

Thanks @tpitale, that would be really helpful!

(If you're curious, Douwe is now CEO at Meltano: https://meltano.com/blog/meltano-spins-out-of-gitlab-raises-seed-round/)

jarkaK commented 2 years ago

@tpitale yep, version release would be great. Thanks a lot!

tpitale commented 2 years ago

0.10.1 merged, releasing shortly