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

Integrate ActiveJob / DeliverLater / GlobalID with Rails #16485

Merged
merged 230 commits into from Aug 17, 2014

Conversation

Projects
None yet
@dhh
Member

dhh commented Aug 12, 2014

WIP.

dhh and others added some commits May 18, 2014

Clean up JobWrappers::ResqueWrapper.perform
This is not only easier to read, but it'll also properly raise an ArgumentError rather than a NoMethodError when called with no arguments.

It also allocates 4 fewer objects per call (8 down from 12), and is about 50% faster according to a quick benchmark.
Merge pull request #1 from charliesome/patch-1
Clean up JobWrappers::ResqueWrapper.perform
Merge pull request #5 from seuros/master
 Add Sidekiq adapter/wrapper fixes #3
Merge pull request #10 from seuros/master
Lazy-load adapters, fixes #6
Dont need the explicit error handling -- if the require fails, it wil…
…l raise exactly the error we want to communicate anyway. Also use the load path, so we can allow plugins, rather than requre_relative
Merge pull request #16 from seuros/master
Setting the adapter load the required gem.
attr_accessor :locked_at
attr_accessor :locked_by
attr_accessor :failed_at
attr_accessor :queue

This comment has been minimized.

@carlosantoniodasilva

carlosantoniodasilva Aug 15, 2014

Member

Just pass all of them into the same accessor call.

@carlosantoniodasilva

carlosantoniodasilva Aug 15, 2014

Member

Just pass all of them into the same accessor call.

This comment has been minimized.

@carlosantoniodasilva

carlosantoniodasilva Aug 15, 2014

Member

Hm now I noticed it was a copy from DJ 😢

@carlosantoniodasilva

carlosantoniodasilva Aug 15, 2014

Member

Hm now I noticed it was a copy from DJ 😢

# Returns the version of the currently loaded ActiveJob as a <tt>Gem::Version</tt>
def self.gem_version
Gem::Version.new VERSION::STRING
end

This comment has been minimized.

@tenderlove

tenderlove Aug 15, 2014

Member

Is this actually necessary? You can get the currently loaded version of a gem from RubyGems:

irb(main):001:0> require 'nokogiri'
=> true
irb(main):002:0> Gem.loaded_specs['nokogiri'].version
=> #<Gem::Version "1.6.3.1">
irb(main):003:0>

Also, what does anyone use this for?

@tenderlove

tenderlove Aug 15, 2014

Member

Is this actually necessary? You can get the currently loaded version of a gem from RubyGems:

irb(main):001:0> require 'nokogiri'
=> true
irb(main):002:0> Gem.loaded_specs['nokogiri'].version
=> #<Gem::Version "1.6.3.1">
irb(main):003:0>

Also, what does anyone use this for?

This comment has been minimized.

@chancancode

chancancode Aug 15, 2014

Member

This was added in #14101. IIRC the motivation was to make comparison easy for gem/plugin authors (if ActiveRecord.gem_version > ...)

@chancancode

chancancode Aug 15, 2014

Member

This was added in #14101. IIRC the motivation was to make comparison easy for gem/plugin authors (if ActiveRecord.gem_version > ...)

This comment has been minimized.

@tenderlove

tenderlove Aug 15, 2014

Member

@chancancode ya, but that was before we knew that you could get the info from RubyGems. I think we should encourage people to query RG for the loaded gem info and rm this code.

@tenderlove

tenderlove Aug 15, 2014

Member

@chancancode ya, but that was before we knew that you could get the info from RubyGems. I think we should encourage people to query RG for the loaded gem info and rm this code.

@tenderlove

This comment has been minimized.

Show comment
Hide comment
@tenderlove

tenderlove Aug 15, 2014

Member

Where does the test harness set up redis queues and pg tables for testing the different queues? I can't seem to find it.

Member

tenderlove commented Aug 15, 2014

Where does the test harness set up redis queues and pg tables for testing the different queues? I can't seem to find it.

@cristianbica

This comment has been minimized.

Show comment
Hide comment
@cristianbica

cristianbica Aug 15, 2014

Member

@tenderlove We have integration tests rails/activejob#102 but:
I wanted to drop them seuros/actionmailer-deliver_later#6 (comment)
@ddh said no :) seuros/actionmailer-deliver_later#6 (comment)
@rafaelfranca said to make separate PR with them https://github.com/seuros/rails/issues/1#issuecomment-51945362
So I'll make the PR once we get this PR merged

Member

cristianbica commented Aug 15, 2014

@tenderlove We have integration tests rails/activejob#102 but:
I wanted to drop them seuros/actionmailer-deliver_later#6 (comment)
@ddh said no :) seuros/actionmailer-deliver_later#6 (comment)
@rafaelfranca said to make separate PR with them https://github.com/seuros/rails/issues/1#issuecomment-51945362
So I'll make the PR once we get this PR merged

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Aug 16, 2014

I'd prefer to leave the default queue name to be 'active_jobs'. 'default' doesn't give you any clue where it came from, and you didn't define it yourself, so you are not expecting it.

dhh commented on activejob/lib/active_job/queue_name.rb in 94ae25e Aug 16, 2014

I'd prefer to leave the default queue name to be 'active_jobs'. 'default' doesn't give you any clue where it came from, and you didn't define it yourself, so you are not expecting it.

@DouweM

This comment has been minimized.

Show comment
Hide comment
@DouweM

DouweM Aug 16, 2014

Contributor

Not related to the PR itself, but I was wondering: what makes some part of Rails "active_" or "action_"? "Active record" was an existing term of course, but what makes ActionMailer and ActiveJob, action and active, relatively?

Contributor

DouweM commented Aug 16, 2014

Not related to the PR itself, but I was wondering: what makes some part of Rails "active_" or "action_"? "Active record" was an existing term of course, but what makes ActionMailer and ActiveJob, action and active, relatively?

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Aug 16, 2014

Member

I've used Action for anything that is frontend aimed (controller/views), Active for backend (models etc).

On Aug 16, 2014, at 12:20, Douwe Maan notifications@github.com wrote:

Not related to the PR itself, but I was wondering: what makes some part of Rails "active_" or "action_"? "Active record" was an existing term of course, but what makes ActionMailer and ActiveJob, action and active, relatively?


Reply to this email directly or view it on GitHub.

Member

dhh commented Aug 16, 2014

I've used Action for anything that is frontend aimed (controller/views), Active for backend (models etc).

On Aug 16, 2014, at 12:20, Douwe Maan notifications@github.com wrote:

Not related to the PR itself, but I was wondering: what makes some part of Rails "active_" or "action_"? "Active record" was an existing term of course, but what makes ActionMailer and ActiveJob, action and active, relatively?


Reply to this email directly or view it on GitHub.

@DouweM

This comment has been minimized.

Show comment
Hide comment
@DouweM

DouweM Aug 16, 2014

Contributor

All right, curiosity satisfied :)

Contributor

DouweM commented Aug 16, 2014

All right, curiosity satisfied :)

dhh added a commit that referenced this pull request Aug 17, 2014

Merge pull request #16485 from seuros/activejob
Integrate ActiveJob / DeliverLater / GlobalID with Rails

@dhh dhh merged commit 49c9f85 into rails:master Aug 17, 2014

1 check was pending

continuous-integration/travis-ci The Travis CI build is in progress
Details
@jeremy

This comment has been minimized.

Show comment
Hide comment
@jeremy

jeremy Aug 18, 2014

Member

🤘

Member

jeremy commented Aug 18, 2014

🤘

@bf4

This comment has been minimized.

Show comment
Hide comment
@bf4

bf4 Aug 18, 2014

Contributor

Hey buddy. Neat looking project, eh?

Contributor

bf4 commented on 080296b Aug 18, 2014

Hey buddy. Neat looking project, eh?

@chancancode

This comment has been minimized.

Show comment
Hide comment
@chancancode

chancancode Aug 19, 2014

Member

@seuros is this a bug fix? do we need to backport this to 4-1-stable as well? I noticed that it already works as a class method there without this patch, so I'm a bit confused. Do you remember what this was about?

Member

chancancode commented on b937ea8 Aug 19, 2014

@seuros is this a bug fix? do we need to backport this to 4-1-stable as well? I noticed that it already works as a class method there without this patch, so I'm a bit confused. Do you remember what this was about?

This comment has been minimized.

Show comment
Hide comment
@chancancode

chancancode Aug 19, 2014

Member

Backported 😄

06b185c

cc @pixeltrix

Member

chancancode replied Aug 19, 2014

Backported 😄

06b185c

cc @pixeltrix

This comment has been minimized.

Show comment
Hide comment
@seuros

seuros Aug 19, 2014

Member

👍

Member

seuros replied Aug 19, 2014

👍

This comment has been minimized.

Show comment
Hide comment
@pixeltrix

pixeltrix Aug 19, 2014

Member

@seuros @chancancode is there an issue for this ?

Member

pixeltrix replied Aug 19, 2014

@seuros @chancancode is there an issue for this ?

This comment has been minimized.

Show comment
Hide comment
@seuros

seuros Aug 19, 2014

Member

in 4.1 it's not an actual bug as the mailers are working and calling .register_preview_interceptor will eventually call the instance method. It's not optimal as it creates an ActionMailer::Base instance and tries to render an email
in 4.2 with the introduction of activejob mailer methods are no longer called until it's needed so the tests for register_preview_interceptor started failing and we noticed that bug
@cristianbica

Member

seuros replied Aug 19, 2014

in 4.1 it's not an actual bug as the mailers are working and calling .register_preview_interceptor will eventually call the instance method. It's not optimal as it creates an ActionMailer::Base instance and tries to render an email
in 4.2 with the introduction of activejob mailer methods are no longer called until it's needed so the tests for register_preview_interceptor started failing and we noticed that bug
@cristianbica

This comment has been minimized.

Show comment
Hide comment
@chancancode

chancancode Aug 19, 2014

Member

@pixeltrix nope this was part of the Active Job pull request. I checked that the register_interceptors method is also defined as a class method, so I assumed this is "working by accident" (that it happens to go through method missing, creates an instance and call the same method on it). Feel free to revert or amend if I'm wrong.

Member

chancancode replied Aug 19, 2014

@pixeltrix nope this was part of the Active Job pull request. I checked that the register_interceptors method is also defined as a class method, so I assumed this is "working by accident" (that it happens to go through method missing, creates an instance and call the same method on it). Feel free to revert or amend if I'm wrong.

This comment has been minimized.

Show comment
Hide comment
@pixeltrix

pixeltrix Aug 20, 2014

Member

@chancancode no, you're right - looks like I missed the class << self when looking at the existing register_interceptors code and it worked by accident.

Member

pixeltrix replied Aug 20, 2014

@chancancode no, you're right - looks like I missed the class << self when looking at the existing register_interceptors code and it worked by accident.

@cristianbica

This comment has been minimized.

Show comment
Hide comment
@cristianbica

cristianbica Aug 19, 2014

Member

@tenderlove here are the integration tests
#16541

Cristian Bica

On Fri, Aug 15, 2014 at 5:07 AM, Aaron Patterson notifications@github.com
wrote:

Where does the test harness set up redis queues and pg tables for testing
the different queues? I can't seem to find it.


Reply to this email directly or view it on GitHub
#16485 (comment).

Member

cristianbica commented Aug 19, 2014

@tenderlove here are the integration tests
#16541

Cristian Bica

On Fri, Aug 15, 2014 at 5:07 AM, Aaron Patterson notifications@github.com
wrote:

Where does the test harness set up redis queues and pg tables for testing
the different queues? I can't seem to find it.


Reply to this email directly or view it on GitHub
#16485 (comment).

@jGRUBBS

This comment has been minimized.

Show comment
Hide comment
@jGRUBBS

jGRUBBS Aug 27, 2014

@mperham why did you remove the later method and raise NIE? I haven't specifically tested this myself, but the later method seems to be appropriate here.

jGRUBBS commented on 0c46094 Aug 27, 2014

@mperham why did you remove the later method and raise NIE? I haven't specifically tested this myself, but the later method seems to be appropriate here.

This comment has been minimized.

Show comment
Hide comment
@mperham

mperham Aug 27, 2014

Contributor

Find the associated PR and conversation for this commit.

Contributor

mperham replied Aug 27, 2014

Find the associated PR and conversation for this commit.

@zhouguangming

This comment has been minimized.

Show comment
Hide comment
@zhouguangming

zhouguangming Aug 27, 2014

Contributor

👍

Contributor

zhouguangming commented Aug 27, 2014

👍

@jGRUBBS

This comment has been minimized.

Show comment
Hide comment
@jGRUBBS

jGRUBBS Aug 27, 2014

@mperham I am looking at the pull request here rails/activejob#35
I still don't see any rationale behind removing the later method in the sucker_punch_adapter unless you have any reason as to why it was removed, could it be added back?

jGRUBBS commented Aug 27, 2014

@mperham I am looking at the pull request here rails/activejob#35
I still don't see any rationale behind removing the later method in the sucker_punch_adapter unless you have any reason as to why it was removed, could it be added back?

@cristianbica

This comment has been minimized.

Show comment
Hide comment
@cristianbica

cristianbica Aug 27, 2014

Member

@jGRUBBS it was proposed again in rails/rails #16643 but because Sucker Punch does not have a persistent store we decided not to accept it.

Member

cristianbica commented Aug 27, 2014

@jGRUBBS it was proposed again in rails/rails #16643 but because Sucker Punch does not have a persistent store we decided not to accept it.

@jGRUBBS

This comment has been minimized.

Show comment
Hide comment
@jGRUBBS

jGRUBBS Aug 27, 2014

@cristianbica thanks for the explanation, now I see.

jGRUBBS commented Aug 27, 2014

@cristianbica thanks for the explanation, now I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment