influitive / apartment-activejob

ActiveJob support for the Apartment Gem
MIT License
19 stars 23 forks source link

Overhaul #2

Closed dgroulx closed 9 years ago

dgroulx commented 9 years ago

Reorganized the existing project to get it working. The only major change was moving the setting of the tenant from a callback to the deserialize method, since deserialization takes place before callbacks are triggered.

bradrobertson commented 9 years ago

I Don't know much about ActiveJob but the only thing I Might suggest is you use

Apartment::Tenant.switch(job_data['tenant']) do
  super
end

Which ensures that the job is run in the current tenant, but reset after it's done (so it doesn't leave you in a weird state)

LaurensN commented 9 years ago

Will this get merged in ? What's the current status of this gem ?

bradrobertson commented 9 years ago

@LaurensN just merged and made some cleanup, but I haven't personally used this at all.

@desheikh have you tried using this? I'm a bit wary of the installation instructions that monkeypatch ActiveJob. Is there no official way to tap into the processing stack?

LaurensN commented 9 years ago

Great! Thanks for the quick reply.

desheikh commented 9 years ago

@LaurensN thanks for the pull request! I'm going to look into this today and try to get a release out. I'm leaning towards an inheritance based solution though, since that's closer to how ActiveJob classes are declared.

LaurensN commented 9 years ago

Don't thank me @desheikh , thank @dgroulx ;). Awesome, and thanks.

desheikh commented 9 years ago

Oops my bad: @dgroulx