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

detect Rails DB connection and use it #232

Merged
merged 9 commits into from
Oct 10, 2014

Conversation

jipiboily
Copy link
Contributor

This is to make it as easy to use queue_classic with Rails, especially with Rails 4.2 + ActiveJob getting out soon-ish.

This is a work in progress. Any help on getting a test for that working would be more than welcomed as I am minitest noob and don't have much more time today for that.

Thoughts on how to test that with minitest?

Related to: #228

TODO:

  • add detection of ActiveRecord and use its connection
  • add test
  • edit README to reflect this new reality
  • add CHANGELOG entry

@jipiboily
Copy link
Contributor Author

A quick review of this code would be welcomed :)

@senny
Copy link
Contributor

senny commented Sep 15, 2014

@jipiboily I'm traveling right now. I can take a look when I get back in a few days.

@jipiboily
Copy link
Contributor Author

It looks like the build is failing on some Ruby version...will need to fix that first. Thanks! :)

@jipiboily jipiboily changed the title WIP - Detect Rails db connection detect Rails db connection Oct 3, 2014
@jipiboily jipiboily changed the title detect Rails db connection detect Rails DB connection Oct 3, 2014
@jipiboily jipiboily changed the title detect Rails DB connection detect Rails DB connection and use it Oct 3, 2014
@jipiboily
Copy link
Contributor Author

@senny @ryandotsmith @ukd1 @smathieu could one of you review this please? It works, just tested with migrations + running a job that uses a model.

I would love to get that merged as soon as possible.

❤️

end

def after_teardown
ensure
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you need the unsure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question! I don't remember...I'll test and if it's required, I'll document the reason.

@smathieu
Copy link
Contributor

smathieu commented Oct 3, 2014

How do you turn this off if that's not what you want?

@jipiboily
Copy link
Contributor Author

Good point about disabling it, I'll add a ENV var to disable it and add to README.

@jipiboily
Copy link
Contributor Author

@smathieu updated. Removed the useless ensure and added a QC_RAILS_DATABASE env var to disable DB detection if required. Also added a note in README regarding the use with ActiveJob.

@jipiboily
Copy link
Contributor Author

Going to merge within a few minutes.

jipiboily added a commit that referenced this pull request Oct 10, 2014
@jipiboily jipiboily merged commit 0045b28 into QueueClassic:master Oct 10, 2014
@jipiboily jipiboily deleted the detect-rails-db-connection branch October 10, 2014 19:24
@senny
Copy link
Contributor

senny commented Oct 16, 2014

@jipiboily I know I'm late to the party but does hits patch address the issues raised in #141 and #96 ?

@jipiboily
Copy link
Contributor Author

Hum, not on purpose, I'll have to read about those threads fully. Regarding #141, we are using AC's connection and never had any problem. We don't use this PR though...

I'll read through later today or tomorrow and report back.

@senny
Copy link
Contributor

senny commented Oct 16, 2014

thanks man. The linked issues were always the case why using the AR connection was never fully supported.

@jipiboily
Copy link
Contributor Author

@senny I'm totally overloaded in both my personal/family and work lifes...so not sure when I'll have even 5 minutes to dedicate to open source :/

@jipiboily
Copy link
Contributor Author

@senny I can't reproduce TBH and I am not sure what to do here. This PR includes a way of disabling the auto use of AR's connection, so it should provide a around at least. Until we have more information or a repro case, I think it's hard to do anything else...

FWIW, we processed over 80 millions of jobs so far and I've never seen this error. #141 was using older versions of Rails and QC, so maybe it is not a problem anymore?

@senny
Copy link
Contributor

senny commented Nov 18, 2014

@jipiboily I'm fine with waiting for problem reports. If it's still an issue I'm sure we'll get reports if it happens again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants