Giter Site home page Giter Site logo

devise-async's Introduction

Devise Async

Tag Build Status Code Climate

Devise Async provides an easy way to configure Devise to send its emails asynchronously using ActiveJob.

Installation

Add this line to your application's Gemfile:

gem 'devise-async'

And then execute:

$ bundle

Or install it yourself as:

$ gem install devise-async

Usage

  1. Setup ActiveJob,
  2. Add :async to the devise call in your model:
class User < ActiveRecord::Base
  devise :database_authenticatable, :async, :confirmable # etc ...
end

Options

Enabling via config

The gem can be enabled/disabled easily via config, for example based on environment.

# config/initializers/devise_async.rb
Devise::Async.enabled = true # | false

Setup via block

To avoid repeating Devise::Async in the initializer file you can use the block syntax similar to what Devise offers.

# config/initializers/devise_async.rb
Devise::Async.setup do |config|
  config.enabled = true
end

Custom mailer class

Customize Devise.mailer at will and devise-async will honor it.

Older versions of Rails and devise

If you want to use this gem with Rails < 5 and/or devise < 4 check out older releases, please.

Testing

RSpec is used for testing. The following should be enough for running the test:

$ bundle exec rspec

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

Released under the MIT License. See the LICENSE file for further details.

devise-async's People

Contributors

astjohn avatar barelyknown avatar bradpsheehan avatar denniskuczynski avatar djsegal avatar glebm avatar jandudulski avatar jigfox avatar jperville avatar kmayer avatar mhfs avatar mkon avatar mohamagdy avatar pranas avatar rymai avatar tak1n avatar weaksauce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devise-async's Issues

`const_get': uninitialized constant Devise::Models::Async (NameError)

Having a strange error when trying to use your devise-async gem. The only thing special I am including is invitable. Here's a stack trace for you:

from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/models.rb:97:in `block (2 levels) in devise'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/models.rb:92:in `each'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/models.rb:92:in `block in devise'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/models.rb:123:in `devise_modules_hook!'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/models.rb:90:in `devise'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/app/models/user.rb:6:in `<class:User>'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/app/models/user.rb:1:in `<top (required)>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:230:in `block in constantize'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `each'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/inflector/methods.rb:229:in `constantize'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise.rb:261:in `get'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/mapping.rb:77:in `to'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/mapping.rb:72:in `modules'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/mapping.rb:89:in `routes'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/mapping.rb:156:in `default_used_route'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/mapping.rb:66:in `initialize'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise.rb:295:in `new'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise.rb:295:in `add_mapping'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/rails/routes.rb:208:in `block in devise_for'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/rails/routes.rb:207:in `each'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/bundler/gems/devise-d5a2a9b2da15/lib/devise/rails/routes.rb:207:in `devise_for'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config/routes.rb:3:in `block in <top (required)>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/actionpack-3.2.8/lib/action_dispatch/routing/route_set.rb:260:in `draw'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config/routes.rb:1:in `<top (required)>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `each'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/file_update_checker.rb:78:in `call'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/activesupport-3.2.8/lib/active_support/file_update_checker.rb:78:in `execute'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/initializable.rb:30:in `run'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `each'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/application.rb:136:in `initialize!'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config/environment.rb:5:in `<top (required)>'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config.ru:4:in `block in <main>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config.ru:1:in `new'
    from /Users/allenwyma/Documents/Aptana Studio 3 Workspace/plangora/config.ru:1:in `<main>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands/server.rb:46:in `app'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands/server.rb:70:in `start'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
    from /Users/allenwyma/.rvm/gems/ruby-1.9.3-p286/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Not quite sure what is going on, but I did have the initializer put in. Any thoughts? Also does this cover invitable gem?

Looking for co-maintainer

Hi guys, I'm looking for someone to join me as co-maintainer of devise-async.

I cannot devote the amount of time I'd like to take proper care of this project and having someone to help me would make things quicker and better for everyone.

Desirable characteristics:

  • active use of devise-async in live production apps
  • history of contributions for OSS

Things I value:

  • good test coverage
  • good docs in the readme
  • backward compatibility
  • maintainers consensus on big code refactoring
  • maintainers consensus on api changes

Please get in touch.

Devise::Async fails silently when included after "devise" call

Hey Marcelo,

I was struggling with some weird issues on my project, and I found out that it was an ordering issue. We were including Devise::Async programmatically before "devise" has been called, and we didn't get any errors, but took us a while to figure this out.

Do you think Devise::Async should at least drop a warning of some sorts? I honestly didn't read the source code to verify how to do this, but if you agree that Devise::Async should do something, let me know; I will be happy to submit a pull request with this.

Thanks!

Email sent before User Record is made

I'm not sure whether this is an issue here, or over at devise. When a new user is created, Sidekiq is throwing an error saying Can't Find User with ID = xxxx. I think this is due to the job been executed before the DB transaction completes.

However, when it then retries the job, the job works perfectly. I can only presume this is something due to maybe sending the email in a after_create hook, and not an after_commit hook. I'll look into the code later to see if this is the issue.

Even if this isn't a devise-async problem it's still worth noting here until it gets solved I guess. Has anyone else come across this? And what was the solution?

Option to specify queue

We all ready have a specific queue we use for other emails in our application, with the current priorities set.

Would it be possible to add an option to specify the queue to use, so we could set it the same as our current email queue? rather than using the default of 'mailer'.

We're using sidekiq, if that makes any difference.

Queue fills up but mails aren't processed by workers

I'm using devise-async and sidekiq in order to send the mails in the background. I've followed the default steps for setting up devise-async and have tried several different things. The issue is that the sidekiq mailer queue fills up with the default devise messages, but they are never processed by the workers.

Gem versions are
Devise 2.1.2
Devise-async 0.4.0
Sidekiq 2.5.3

http://stackoverflow.com/questions/13452020/background-mailing-through-sidekiq-and-devise-async-queue-fills-up-but-mails-ar

Thanks,

Julius

Problem while testing

Hi there,

I've followed the instructions as per the README and I'm rolling Devise 2.1.2 and delayed_job. In my cucumber tests, I no longer receive the confirmation email as part of the sign-up process. Is there something I should be doing as part of testing? I already set delayed job to skip the actual delay for testing by setting the following in my test environment.

Delayed::Worker.delay_jobs = false

But even with this set to true, it still fails, albeit more slowly. If I remove the devise_async gem and the relevant lines, everything bursts back into life.

Thanks,
Graeme

Tests Failing

Hi,
I am trying to package devise-async for Debian as part of GitLab packaging. While running tests, I got two failures. Can you help me find out what the issue is?

Running:

........................F..F....

Finished in 2.304009s, 13.8888 runs/s, 17.3610 assertions/s.

  1. Failure:
    Model#test_0004_triggers the enqueued notifications on save [/devise-async/ruby-devise-async-0.9.0/test/devise/async/model_test.rb:50]:
    Expected: 1
    Actual: 2

  2. Failure:
    Model#test_0003_accumulates notifications to be sent after commit when Model has been changed [/devise-async/ruby-devise-async-0.9.0/test/devise/async/model_test.rb:32]:
    Expected: 1
    Actual: 2

32 runs, 40 assertions, 2 failures, 0 errors, 0 skips

User Registration Timing Out on Development

Do you have a solution for this error? Log below.

Redis::CannotConnectError (Error connecting to Redis on 127.0.0.1:6379 (Redis::TimeoutError)):
redis (3.2.1) lib/redis/client.rb:331:in rescue in establish_connection' redis (3.2.1) lib/redis/client.rb:317:inestablish_connection'
redis (3.2.1) lib/redis/client.rb:94:in block in connect' redis (3.2.1) lib/redis/client.rb:279:inwith_reconnect'
redis (3.2.1) lib/redis/client.rb:93:in connect' redis (3.2.1) lib/redis/client.rb:350:inensure_connected'
redis (3.2.1) lib/redis/client.rb:207:in block in process' redis (3.2.1) lib/redis/client.rb:292:inlogging'
redis (3.2.1) lib/redis/client.rb:206:in process' redis (3.2.1) lib/redis/client.rb:177:incall_pipelined'
redis (3.2.1) lib/redis/client.rb:149:in block in call_pipeline' redis (3.2.1) lib/redis/client.rb:279:inwith_reconnect'
redis (3.2.1) lib/redis/client.rb:147:in call_pipeline' redis (3.2.1) lib/redis.rb:2182:inblock in multi'
redis (3.2.1) lib/redis.rb:37:in block in synchronize' C:/Ruby214/lib/ruby/2.1.0/monitor.rb:211:inmon_synchronize'
redis (3.2.1) lib/redis.rb:37:in synchronize' redis (3.2.1) lib/redis.rb:2174:inmulti'
sidekiq (3.3.3) lib/sidekiq/client.rb:179:in block in raw_push' connection_pool (2.1.3) lib/connection_pool.rb:62:inwith'
sidekiq (3.3.3) lib/sidekiq/client.rb:178:in raw_push' sidekiq (3.3.3) lib/sidekiq/client.rb:68:inpush'
sidekiq (3.3.3) lib/sidekiq/worker.rb:84:in client_push' sidekiq (3.3.3) lib/sidekiq/worker.rb:40:inperform_async'
devise-async-stretch (0.0.6) lib/devise/async/stretch/backend/sidekiq.rb:11:in enqueue_job' devise-async-stretch (0.0.6) lib/devise/async/stretch/worker.rb:7:inenqueue'
devise-async-stretch (0.0.6) lib/devise/async/stretch/model.rb:34:in `enqueue_stre

#deliver will be removed in Rails 5; replace with #deliver_now

I'm running my test suite using Rails 4.2.0.rc1 (coming from 4.1.16). I'm receiving the following deprecation warning.

DEPRECATION WARNING: `#deliver` is deprecated and will be removed in Rails 5.
Use `#deliver_now` to deliver immediately or `#deliver_later` to deliver through Active Job.

This line just needs to be adjusted to handle the new approach.

NoMethodError: protected method devise_mailer called for <User:0x1b8a096f>

I just received this error after doing some bundle updates

NoMethodError: protected method 'devise_mailer' called for #<User:0x1b8a096f>

Here is the relevant backtrace:

org/jruby/RubyKernel.java:1955 in "public_send"
/gems/activesupport-4.1.8/lib/active_support/core_ext/object/try.rb:45 in "try"
/gems/devise-async-0.9.0/lib/devise/async/backend/base.rb:22 in "mailer_class"
/gems/devise-async-0.9.0/lib/devise/async/backend/base.rb:16 in "perform"
/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:75 in "execute_job"
/gems/sidekiq-3.3.0/lib/sidekiq/processor.rb:52 in "process"
org/jruby/RubyProc.java:271 in "call"
/gems/sidekiq-3.3.0/lib/sidekiq/middleware/chain.rb:127 in "invoke"

As a temporary fix, we have removed the resource.try(:devise_mailer) for now.

We are using Devise 3.4.1 with sidekiq.

Resque-retry for devise-async

Hi!

Could you maybe implement resque-retry for devise-async?
Sometimes our mailserver times out and we have to retry the devise mails again manually?

Thanks for your great work!

devise sidekiq error - /css isn't paths

2013-03-04T06:06:10Z 6440 TID-1jsgxs WARN: {"retry"=>true, "queue"=>"mailer", "class"=>"Devise::Async::Backend::Sidekiq", "args"=>["confirmation_instructions", "User", "1", {}], "jid"=>"ddc339d19f774907dd96c408", "error_message"=>"/css isn't in paths: /home/love/rails/odbf11/app/assets/FortAwesome-Font-Awesome-ee55c85, /home/love/rails/odbf11/app/assets/font, /home/love/rails/odbf11/app/assets/fonts, /home/love/rails/odbf11/app/assets/fonts1, /home/love/rails/odbf11/app/assets/images, /home/love/rails/odbf11/app/assets/javascripts, /home/love/rails/odbf11/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/multiselectjs_rails-0.3.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/multiselectjs_rails-0.3.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/bundler/gems/best_in_place-6826c9fe49bf/lib/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-rails-2.2.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/bourbon-3.1.1/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/fonts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/maktoub-0.2.5/app/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/maktoub-0.2.5/app/assets/stylesheets, /home/love/rails/odbf11/lib/fgrid/lib/assets/javascripts, /home/love/rails/odbf11/lib/fgrid/lib/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/formtastic-2.2.1/app/assets/stylesheets, /home/love/rails/odbf11/lib/rails3-jquery-autocomplete/lib/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/css3-progress-bar-rails-0.4.0/app/assets/stylesheets, /home/love/rails/odbf11/app/assets", "error_class"=>"Sprockets::FileOutsidePaths", "failed_at"=>2013-03-04 06:06:10 UTC, "retry_count"=>0}
2013-03-04T06:06:10Z 6440 TID-1jsgxs WARN: /css isn't in paths: /home/love/rails/odbf11/app/assets/FortAwesome-Font-Awesome-ee55c85, /home/love/rails/odbf11/app/assets/font, /home/love/rails/odbf11/app/assets/fonts, /home/love/rails/odbf11/app/assets/fonts1, /home/love/rails/odbf11/app/assets/images, /home/love/rails/odbf11/app/assets/javascripts, /home/love/rails/odbf11/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-fileupload-rails-0.4.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/multiselectjs_rails-0.3.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/multiselectjs_rails-0.3.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/bundler/gems/best_in_place-6826c9fe49bf/lib/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-ui-rails-4.0.1/vendor/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/activeadmin-0.5.1/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/jquery-rails-2.2.1/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/bourbon-3.1.1/app/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/fonts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/images, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/compass_twitter_bootstrap-2.0.3/vendor/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/maktoub-0.2.5/app/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/maktoub-0.2.5/app/assets/stylesheets, /home/love/rails/odbf11/lib/fgrid/lib/assets/javascripts, /home/love/rails/odbf11/lib/fgrid/lib/assets/stylesheets, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/formtastic-2.2.1/app/assets/stylesheets, /home/love/rails/odbf11/lib/rails3-jquery-autocomplete/lib/assets/javascripts, /home/love/.rvm/gems/ruby-1.9.3-p194/gems/css3-progress-bar-rails-0.4.0/app/assets/stylesheets, /home/love/rails/odbf11/app/assets
2013-03-04T06:06:10Z 6440 TID-1jsgxs WARN: /home/love/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.0.4/lib/sprockets/asset_attributes.rb:53:in `logical_path'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.0.4/lib/sprockets/base.rb:99:in `find_asset'
/home/love/.rvm/gems/ruby-1.9.3-p194/gems/sprockets-2.0.4/lib/sprockets/environment.rb:72:in `find_asset'

devise-async 0.3.0 not working with devise 2.1.2

Hi,

I have configured the devise-async gem as follows:

# config/initializers/devise_async.rb
Devise::Async.backend = :delayed_job
Devise::Async.queue = :mailers
# app/models/user.rb
# [...]
  devise :database_authenticatable, :registerable, :token_authenticatable, :confirmable,
         :recoverable, :rememberable, :trackable, :validatable, :session_limitable

  include Devise::Async::Model # should be below call to `devise`
# [...]

I'm using delayed_job 3.0.3 (delayed_job_active_record 0.3.2). The problem is no job is created and no email is sent. For example, when I try to recover password:

Started POST "/es/users/password" for 127.0.0.1 at 2012-08-07 10:45:41 +0200
Processing by Devise::PasswordsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"WFaaUqoCZewV9o/V+T6rXYAof32YizuXNGk0jujCG6I=", "user"=>{"email"=>"[email protected]"}, "commit"=>"Solicitar instrucciones", "locale"=>"es"}
  User Load (0.2ms)  SELECT `users`.* FROM `users` WHERE `users`.`email` = '[email protected]' LIMIT 1
Redirected to http://localhost:3000/es/sign_in
Completed 302 Found in 29ms (ActiveRecord: 0.0ms)


Started GET "/es/sign_in" for 127.0.0.1 at 2012-08-07 10:45:41 +0200
Processing by Devise::SessionsController#new as HTML
  Parameters: {"locale"=>"es"}
   (0.1ms)  BEGIN
   (0.1ms)  COMMIT
  Rendered devise/_links.html.haml (1.6ms)
  Rendered devise/sessions/new.html.haml within layouts/application (30.4ms)
Completed 200 OK in 161ms (Views: 156.0ms | ActiveRecord: 0.4ms)

How can I debug what's happening?

Thank you.

sending duplicate confirmation emails when using my own after_create callback

Hello, I'd like to help debug this, I'm getting two emails sent to my new user when I have my own after_create callback set up for my User model.

When I commented out my after_create method, only one confirmation email was sent, but if I leave it in, two are sent. Here's my log talking about the creation of a user, enqueuing a delayed job, doing my own after_create callback (listing_credit) and then another job is enqueued after listing_credit is created:

18:46:21 thin.1 |   SQL (1.8ms)  INSERT INTO "users" (removing all my user attributes for ease of reading)
18:46:21 thin.1 |   User Exists (0.4ms)  SELECT 1 FROM "users" WHERE ("users"."email" = '[email protected]' AND "users"."id" != 603) LIMIT 1
18:46:21 thin.1 |    (0.3ms)  UPDATE "users" SET "phone" = '', "encrypted_password" = '$2a$10$2307dpkG40mXCDI65xgdUuZwhoDnp6g7jtiVhkim3/biL3p79fwvm', "tos" = 't', "confirmation_token" = 'fKKJn9qq4gHonHBNuq6E', "confirmation_sent_at" = '2013-02-12 23:46:21.013395', "created_at" = '2013-02-12 23:46:21.014126', "updated_at" = '2013-02-12 23:46:21.014126', "unconfirmed_email" = '[email protected]', "roles" = '---
18:46:21 thin.1 | - normal
18:46:21 thin.1 | ' WHERE "users"."id" = 603
18:46:21 thin.1 |   User Load (0.5ms)  SELECT "users".* FROM "users" WHERE "users"."confirmation_token" = 'c3XujxpV5EByGDiFNJM1' LIMIT 1
18:46:21 thin.1 |    (0.4ms)  UPDATE "users" SET "phone" = '', "encrypted_password" = '$2a$10$2307dpkG40mXCDI65xgdUuZwhoDnp6g7jtiVhkim3/biL3p79fwvm', "tos" = 't', "confirmation_sent_at" = '2013-02-12 23:46:21.022552', "created_at" = '2013-02-12 23:46:21.014126', "updated_at" = '2013-02-12 23:46:21.014126', "unconfirmed_email" = '[email protected]', "confirmation_token" = 'c3XujxpV5EByGDiFNJM1', "roles" = '---
18:46:21 thin.1 | - normal
18:46:21 thin.1 | ' WHERE "users"."id" = 603

18:46:21 thin.1 |   SQL (0.7ms)  INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at", "handler", "last_error", "locked_at", "locked_by", "priority", "queue", "run_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING "id"  [["attempts", 0], ["created_at", Tue, 12 Feb 2013 18:46:21 EST -05:00], ["failed_at", nil], ["handler", "--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/object:Devise::Async::Backend::DelayedJob {}\nmethod_name: :perform\nargs:\n- :confirmation_instructions\n- User\n- '603'\n- :to: [email protected]\n"], ["last_error", nil], ["locked_at", nil], ["locked_by", nil], ["priority", 0], ["queue", :mailer], ["run_at", Tue, 12 Feb 2013 18:46:21 EST -05:00], ["updated_at", Tue, 12 Feb 2013 18:46:21 EST -05:00]]
18:46:21 thin.1 |   SystemSetting Load (0.5ms)  SELECT "system_settings".* FROM "system_settings" ORDER BY "system_settings"."id" DESC LIMIT 1
18:46:21 thin.1 |   ListingCredit Load (0.9ms)  SELECT "listing_credits".* FROM "listing_credits" WHERE "listing_credits"."user_id" = 603 LIMIT 1
18:46:21 thin.1 |   ListingCredit Exists (0.5ms)  SELECT 1 FROM "listing_credits" WHERE "listing_credits"."user_id" = 603 LIMIT 1

18:46:21 thin.1 |   SQL (1.1ms)  INSERT INTO "listing_credits" (removing listing_credit attributes for ease of reading)

18:46:21 thin.1 |   SQL (0.7ms)  INSERT INTO "delayed_jobs" ("attempts", "created_at", "failed_at", "handler", "last_error", "locked_at", "locked_by", "priority", "queue", "run_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING "id"  [["attempts", 0], ["created_at", Tue, 12 Feb 2013 18:46:21 EST -05:00], ["failed_at", nil], ["handler", "--- !ruby/object:Delayed::PerformableMethod\nobject: !ruby/object:Devise::Async::Backend::DelayedJob {}\nmethod_name: :perform\nargs:\n- :confirmation_instructions\n- User\n- '603'\n- {}\n"], ["last_error", nil], ["locked_at", nil], ["locked_by", nil], ["priority", 0], ["queue", :mailer], ["run_at", Tue, 12 Feb 2013 18:46:21 EST -05:00], ["updated_at", Tue, 12 Feb 2013 18:46:21 EST -05:00]]

my callback that seems to cause it:

  after_create :create_listing_credit

  private

  def create_listing_credit
    # also adding normal role
    add_role!("normal")
    setting = SystemSetting.last 
    setting = SystemSetting.new() if setting.nil?
    if listing_credit.nil?
      listing_credit = ListingCredit.create(:user_id=>self.id,:ticket_credits=>setting.ticket_credits,:group_credits=>setting.group_credits,:refill_at=>Time.now+30.days)
    end
    listing_credit
  end

Job Devise::Async::Backend::DelayedJob#perform...FAILED (5 prior attempts) with ArgumentError: wrong number of arguments (2 for 1)

Hi!

Delayed_job has been unable to send emails. It says that the argument is wrong and this is what I got from delayed_job.log. Please let me know how I can fix it. Thanks!

2013-12-02T19:41:31+0800: [Worker(delayed_job.0 host:swagly.com pid:7937)] Job Devise::Async::Backend::DelayedJob#perform (id=5126) RUNNING
2013-12-02T19:41:31+0800: [Worker(delayed_job.0 host:swagly.com pid:7937)] Job Devise::Async::Backend::DelayedJob#perform (id=5126) FAILED (5 prior attempts) with ArgumentError: wrong number of arguments (2 for 1)

devise_async strange redis log

Hi,
I just setup my rails application using devise_async
This is my gem file looks like

gem 'sidekiq'
gem 'sinatra', require: false
gem 'devise'
gem 'devise-async'

and this is the setup on the config/initializers/devise_async.rb :

Devise::Async.setup do |config|
  config.enabled = true
  config.backend = :sidekiq
end

And setup for user.rb:

devise :database_authenticatable, :async, :confirmable

So I run my rails, redis-server, and sidekiq and also open the redis-cli
On the redis-cli i turn on the Monitor and i got this bunch of log, even I havent run anything like register the new user or sending email to confirm, etc from devise

127.0.0.1:6379> monitor
OK
1426128341.132424 [0 127.0.0.1:62860] "brpop" "queue:default" "1"
1426128343.040102 [0 127.0.0.1:62860] "brpop" "queue:default" "1"
1426128343.542666 [0 127.0.0.1:62865] "multi"
1426128343.542727 [0 127.0.0.1:62865] "sadd" "processes" "Rizals-MacBook-Pro.local:81122"
1426128343.542745 [0 127.0.0.1:62865] "hmset" "Rizals-MacBook-Pro.local:81122" "info" "{\"hostname\":\"Rizals-MacBook-Pro.local\",\"started_at\":1426127583.1370099,\"pid\":81122,\"tag\":\"My-Trades-Men\",\"concurrency\":25,\"queues\":[\"default\"],\"labels\":[]}" "busy" "0" "beat" "1426128343.542463"
1426128343.542805 [0 127.0.0.1:62865] "expire" "Rizals-MacBook-Pro.local:81122" "60"
1426128343.542817 [0 127.0.0.1:62865] "rpop" "Rizals-MacBook-Pro.local:81122-signals"
1426128343.542838 [0 127.0.0.1:62865] "exec"
1426128344.494052 [0 127.0.0.1:62865] "zrangebyscore" "retry" "-inf" "1426128344.493691" "LIMIT" "0" "1"
1426128344.494613 [0 127.0.0.1:62865] "zrangebyscore" "schedule" "-inf" "1426128344.493691" "LIMIT" "0" "1"
1426128345.013881 [0 127.0.0.1:62860] "brpop" "queue:default" "1"
1426128347.026389 [0 127.0.0.1:62860] "brpop" "queue:default" "1"
1426128348.543689 [0 127.0.0.1:62865] "multi"
1426128348.543784 [0 127.0.0.1:62865] "sadd" "processes" "Rizals-MacBook-Pro.local:81122"
1426128348.543810 [0 127.0.0.1:62865] "hmset" "Rizals-MacBook-Pro.local:81122" "info" "{\"hostname\":\"Rizals-MacBook-Pro.local\",\"started_at\":1426127583.1370099,\"pid\":81122,\"tag\":\"My-Trades-Men\",\"concurrency\":25,\"queues\":[\"default\"],\"labels\":[]}" "busy" "0" "beat" "1426128348.5435572"
1426128348.543862 [0 127.0.0.1:62865] "expire" "Rizals-MacBook-Pro.local:81122" "60"
1426128348.543876 [0 127.0.0.1:62865] "rpop" "Rizals-MacBook-Pro.local:81122-signals"
1426128348.543893 [0 127.0.0.1:62865] "exec"
1426128349.067366 [0 127.0.0.1:62860] "brpop" "queue:default" "1"

Does this look normal ?

Thanks

Reset passwords instructions is not being sent

The reset password instructions generate a token, after that token is generated a commit happened so the method send_devise_pending_notifications is called and the list of pending notifications is empty. After that the send_devise_notification is called and added a pending notification but that notification is never being sent.

I18n

Hello,

I am using devise with i18n. But when the job is performed by the worker it uses the default locale.

gem 'devise-i18n'
gem 'devise-i18n-views'

I think the job should contains the locale and set the locale before sending the email.

Not working with sidekiq

Hi, my gem are with these versions:

sidekiq 2.3.0
devise 2.1.2
devise-async 0.3.1

When I try do send some mail through devise, no job was created and the email was not delivery.

I triple check the tutorial and my files and there is everything correct on my vision.

Is it a bug?

smtp settings not being forwarded

Hi guys, my environment is:
rails-3.2.21
devise-async-0.10.1
sidekiq-3.4.2
devise-3.5.2

and my development.rb has the following lines:

AdBuilder::Application.configure do
    config.paperclip_defaults = { }
    config.action_mailer.delivery_method = :smtp
    config.action_mailer.smtp_settings = APPCONFIG.setup_mail
    config.action_mailer.default_url_options = { :host => APPCONFIG.host }
end

Mail.defaults do
   delivery_method :smtp, APPCONFIG.setup_mail
end

where
APPCONFIG.setup_mail = {"port"=>587, "address"=>"smtp.mailgun.org", "user_name"=>"username", "password"=>"password", "domain"=>"dom", "authentication"=>:plain, "enable_starttls_auto"=>true}

When I click 'forgot password' I get the following error:
2015-09-09T11:51:40.540Z 6949 TID-1b2a6k Devise::Async::Backend::Sidekiq JID-a860405bf58683ca0c52bf50 INFO: start
2015-09-09T11:51:40.690Z 6949 TID-1b2a6k Devise::Async::Backend::Sidekiq JID-a860405bf58683ca0c52bf50 INFO: fail: 0.15 sec
2015-09-09T11:51:40.697Z 6949 TID-1b2a6k WARN: {"class"=>"Devise::Async::Backend::Sidekiq", "args"=>["reset_password_instructions", "User", "1023", "hMq_QtTtFAe6yNoQzA-4", {}], "retry"=>true, "queue"=>"mailer", "jid"=>"a860405bf58683ca0c52bf50", "created_at"=>1441797909.8741653, "enqueued_at"=>1441799500.5298817, "error_message"=>"no implicit conversion of nil into Hash", "error_class"=>"TypeError", "failed_at"=>1441797929.8455174, "retry_count"=>6, "retried_at"=>1441799500.6890008}

2015-09-09T11:51:40.697Z 6949 TID-1b2a6k WARN: TypeError: no implicit conversion of nil into Hash
2015-09-09T11:51:40.697Z 6949 TID-1b2a6k WARN: /home/ingolfur/.rvm/gems/ruby-2.0.0-p645/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:90:in 'merge!'
/home/ingolfur/.rvm/gems/ruby-2.0.0-p645/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:90:in 'initialize'
/home/ingolfur/.rvm/gems/ruby-2.0.0-p645/gems/mail-2.5.4/lib/mail/message.rb:257:in 'new'
/home/ingolfur/.rvm/gems/ruby-2.0.0-p645/gems/mail-2.5.4/lib/mail/message.rb:257:in 'delivery_method'
/home/ingolfur/.rvm/gems/ruby-2.0.0-p645@/gems/actionmailer-3.2.21/lib/action_mailer/delivery_methods.rb:69:in 'wrap_delivery_behavior'
/home/ingolfur/.rvm/gems/ruby-2.0.0-p645@/gems/actionmailer-3.2.21/lib/action_mailer/delivery_methods.rb:83:in 'wrap_delivery_behavior!'

And when I byebug that method, it looks like the config.action_mailer.smtp_settings is not getting through (even though it's clearly defined with the right values for both sidekiq and the rails server). Any ideas how to solve / debug this?
Thanks!

Devise::Async::Backend::DelayedJob#perform failed with Net::SMTPAuthenticationError: 435 4.7.8 Error: authentication failed:

Output is below. Using Rails 3.2.12, Devise 2.2.3, Devise-Async 0.6.0, Delayed_job_active_record 0.4.3, and Delayed_Job 3.0.5.

Note that other mailers work just fine. It is only the Devise mailers that seem to have issues.

Handler:

--- !ruby/object:Delayed::PerformableMethod
object: !ruby/object:Devise::Async::Backend::DelayedJob {}
method_name: :perform
args:

  • :reset_password_instructions
  • User
  • '1'
  • {}

Last Error:

435 4.7.8 Error: authentication failed:

/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:960:in check_auth_response' /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:737:inauth_plain'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:729:in authenticate' /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:564:indo_start'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/net/smtp.rb:519:in start' /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/network/delivery_methods/smtp.rb:144:indeliver!'
/app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:2034:in do_delivery' /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:inblock in deliver'
/app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:415:in block in deliver_mail' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:inblock in instrument'
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in instrument' /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:ininstrument'
/app/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.12/lib/action_mailer/base.rb:413:in deliver_mail' /app/vendor/bundle/ruby/1.9.1/gems/mail-2.4.4/lib/mail/message.rb:229:indeliver'
/app/vendor/bundle/ruby/1.9.1/gems/devise-async-0.6.0/lib/devise/async/backend/base.rb:15:in perform' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/performable_method.rb:26:inperform'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:95:in block in invoke_job' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in block in initialize' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in execute' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:inrun_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/backend/base.rb:92:in invoke_job' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:203:inblock (2 levels) in run'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/timeout.rb:68:in timeout' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:203:inblock in run'
/app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in realtime' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:202:inrun'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:259:in block in reserve_and_run_one_job' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in block in initialize' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in execute' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:inrun_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:259:in reserve_and_run_one_job' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:187:inblock in work_off'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:186:in times' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:186:inwork_off'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:151:in block (4 levels) in start' /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:inrealtime'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:150:in block (3 levels) in start' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in block in initialize' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in execute' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:inrun_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:149:in block (2 levels) in start' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:148:inloop'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:148:in block in start' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:7:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/plugins/clear_locks.rb:7:in block (2 levels) in ' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:in block (2 levels) in add' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:60:in block in initialize' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:78:in block in add' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:incall'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:65:in execute' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/lifecycle.rb:38:inrun_callbacks'
/app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/worker.rb:147:in start' /app/vendor/bundle/ruby/1.9.1/gems/delayed_job-3.0.5/lib/delayed/tasks.rb:9:inblock (2 levels) in '
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in call' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:inblock in execute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in each' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:inexecute'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in block in invoke_with_call_chain' /app/vendor/ruby-1.9.3/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in invoke_with_call_chain' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:ininvoke'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in invoke_task' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:inblock (2 levels) in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in each' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:inblock in top_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in run_with_threads' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:intop_level'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in block in run' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:instandard_exception_handling'
/app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in run' /app/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/bin/rake:33:in'
/app/vendor/bundle/ruby/1.9.1/bin/rake:23:in load' /app/vendor/bundle/ruby/1.9.1/bin/rake:23:in'

Any option to add delay ?

Hello!
Sometimes(not always), when creating user with email confirmation I get ActiveRecord::RecordNotFound, because user is not in DB yet, so is it possible to add some delay for email sending ?
Thanks in advance

Allow enable flag in config

We use devise async with great success in prod, but would like to see sync generation in dev (to more easily catch errors).

Can we get a setting along the lines of:

Devise::Async.enable = false # <= configatron driven

Thanks!

Queue for DelayedJob

Just curious, any reason to not include "config.queue" support for DelayedJob? As of v3 DelayedJob does support a queue.


DJ 3 introduces Resque-style named queues while still retaining DJ-style priority. The goal is to provide a system for grouping tasks to be worked by separate pools of workers, which may be scaled and controlled individually.

Jobs can be assigned to a queue by setting the queue option:
object.delay(:queue => 'tracking').method
Delayed::Job.enqueue job, :queue => 'tracking'
handle_asynchronously :tweet_later, :queue => 'tweets'

Works awesome but how to stop sending emails in tests?

Before using devise-async, these sort of settings in test.rb avoiding sending e-mails in tests:

Don't care if the mailer can't send

config.action_mailer.raise_delivery_errors = false

Disable sending e-mail in testing

config.action_mailer.perform_deliveries = false

config.action_mailer.delivery_method = :test

Any advice on how to avoid having the tests post redis/resque messages?

failure in jruby

I'm using sidekiq, rails 4.

Everything works well under MRI 2.1. In JRuby 1.7.6, I get this:

NoMethodError: undefined method `devise_mailer' for #<User:0x1e077d66>

I'm exploring what the problem could be. The full stack trace is below.

2013-11-20T21:11:17Z 51784 TID-6gc ERROR: Sidekiq::Processor crashed!
NoMethodError: undefined method `devise_mailer' for #<User:0x1e077d66>

org/jruby/RubyBasicObject.java:1497:in `method_missing'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/activemodel-4.0.1/lib/active_model/attribute_methods.rb:436:in `method_missing'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/activerecord-4.0.1/lib/active_record/attribute_methods.rb:155:in `method_missing'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/rolify-3.2.0/lib/rolify/role.rb:73:in `method_missing'
org/jruby/RubyKernel.java:1958:in `public_send'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/activesupport-4.0.1/lib/active_support/core_ext/object/try.rb:45:in `try'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/devise-async-0.9.0/lib/devise/async/backend/base.rb:22:in `mailer_class'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/devise-async-0.9.0/lib/devise/async/backend/base.rb:16:in `perform'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:48:in `process'
org/jruby/RubyProc.java:271:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:119:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/rollbar-0.11.8/lib/rollbar/sidekiq.rb:7:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:121:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/newrelic_rpm-3.6.9.171/lib/new_relic/agent/instrumentation/sidekiq.rb:30:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/newrelic_rpm-3.6.9.171/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:339:in `perform_action_with_newrelic_trace'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/newrelic_rpm-3.6.9.171/lib/new_relic/agent/instrumentation/sidekiq.rb:21:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:121:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:121:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/server/retry_jobs.rb:62:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:121:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/server/logging.rb:11:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/logging.rb:22:in `with_context'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:121:in `invoke'
org/jruby/RubyProc.java:271:in `call'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/middleware/chain.rb:124:in `invoke'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:47:in `process'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:102:in `stats'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:46:in `process'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:83:in `do_defer'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/sidekiq-2.16.1/lib/sidekiq/processor.rb:37:in `process'
org/jruby/RubyKernel.java:1961:in `public_send'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in `dispatch'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:in `dispatch'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in `handle_message'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:in `task'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in `initialize'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:47:in `initialize'
/Users/john/.rbenv/versions/jruby-1.7.6/lib/ruby/gems/shared/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:in `create'

Using async to resend confirmation email and it breaks with the following issue: ArgumentError: wrong number of arguments (2 for 1)

Hello,

I was trying to use resend confirmation functionality and got this error.

ArgumentError: wrong number of arguments (2 for 1)
/gems/devise-async-0.5.0/lib/devise/async/model.rb:38

Rails: 3.2.11
Warden: 1.2.1
Devise: 2.2.3

Parameters were sent:

{"utf8"=>"✓",
 "authenticity_token"=>"0dfFSLz9o2Rq+U8E9DvpJjPu/8GHNXWGHDV75AQGEo0=",
 "user"=>{"email"=>"[email protected]"},
 "commit"=>"Resend",
 "action"=>"create",
 "controller"=>"devise/confirmations"}

Full backtrace

[GEM_ROOT]/gems/devise-async-0.5.0/lib/devise/async/model.rb:38:in `send_devise_notification'
[GEM_ROOT]/gems/devise-2.2.3/lib/devise/models/confirmable.rb:92:in `send_confirmation_instructions'
[GEM_ROOT]/gems/devise-2.2.3/lib/devise/models/confirmable.rb:99:in `block in resend_confirmation_token'
[GEM_ROOT]/gems/devise-2.2.3/lib/devise/models/confirmable.rb:184:in `pending_any_confirmation'
[GEM_ROOT]/gems/devise-2.2.3/lib/devise/models/confirmable.rb:97:in `resend_confirmation_token'
[GEM_ROOT]/gems/devise-2.2.3/lib/devise/models/confirmable.rb:233:in `send_confirmation_instructions'
[GEM_ROOT]/gems/devise-2.2.3/app/controllers/devise/confirmations_controller.rb:9:in `create'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:167:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/rendering.rb:10:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:470:in `block in _run__773501976330530268__process_action__3689171844690471955__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:218:in `_conditional_callback_around_1173'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:458:in `_run__773501976330530268__process_action__3689171844690471955__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/abstract_controller/callbacks.rb:17:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/rescue.rb:29:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `block in instrument'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/notifications.rb:123:in `instrument'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
[GEM_ROOT]/gems/activerecord-3.2.11/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/abstract_controller/base.rb:121:in `process'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/abstract_controller/rendering.rb:45:in `process'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal.rb:203:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_controller/metal.rb:246:in `block in action'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:36:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/routing/mapper.rb:42:in `call'
[GEM_ROOT]/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
[GEM_ROOT]/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
[GEM_ROOT]/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:601:in `call'
[GEM_ROOT]/gems/rack-pjax-0.7.0/lib/rack/pjax.rb:12:in `call'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/rack/error_collector.rb:8:in `call'
[GEM_ROOT]/gems/newrelic_rpm-3.5.5.38/lib/new_relic/rack/browser_monitoring.rb:12:in `call'
[GEM_ROOT]/gems/sass-3.2.5/lib/sass/plugin/rack.rb:54:in `call'
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:35:in `block in call'
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:34:in `catch'
[GEM_ROOT]/gems/warden-1.2.1/lib/warden/manager.rb:34:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/etag.rb:23:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/conditionalget.rb:35:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/head.rb:14:in `call'
[GEM_ROOT]/gems/remotipart-1.0.2/lib/remotipart/middleware.rb:30:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/flash.rb:242:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/session/abstract/id.rb:210:in `context'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/session/abstract/id.rb:205:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/cookies.rb:341:in `call'
[GEM_ROOT]/gems/activerecord-3.2.11/lib/active_record/query_cache.rb:64:in `call'
[GEM_ROOT]/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `_run__2263208940848071590__call__1922960617359973094__callbacks'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:405:in `__run_callback'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/callbacks.rb:81:in `run_callbacks'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/rack/logger.rb:32:in `call_app'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `block in call'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/tagged_logging.rb:22:in `tagged'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/rack/logger.rb:16:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/request_id.rb:22:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/methodoverride.rb:21:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/runtime.rb:17:in `call'
[GEM_ROOT]/gems/activesupport-3.2.11/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
[GEM_ROOT]/gems/rack-1.4.4/lib/rack/lock.rb:15:in `call'
[GEM_ROOT]/gems/actionpack-3.2.11/lib/action_dispatch/middleware/static.rb:62:in `call'
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:143:in `pass'
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:155:in `invalidate'
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:71:in `call!'
[GEM_ROOT]/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/engine.rb:479:in `call'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/application.rb:223:in `call'
[GEM_ROOT]/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/connection.rb:81:in `block in pre_process'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/connection.rb:79:in `catch'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/connection.rb:79:in `pre_process'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/connection.rb:54:in `process'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/connection.rb:39:in `receive_data'
[GEM_ROOT]/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
[GEM_ROOT]/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/backends/base.rb:63:in `start'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/server.rb:159:in `start'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/controllers/controller.rb:86:in `start'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/runner.rb:187:in `run_command'
[GEM_ROOT]/gems/thin-1.5.0/lib/thin/runner.rb:152:in `run!'
[GEM_ROOT]/gems/thin-1.5.0/bin/thin:6:in `<top (required)>'
/home/dirtrally-production/app/shared/bundle/bin/thin:16:in `load'
/home/dirtrally-production/app/shared/bundle/bin/thin:16:in `<main>'

I just tried removing async from the User model and it worked. So apparently, there is something wrong with async module. Did anyone else experienced this issue?

undefined method `after_commit' for User:Class

This is my model :

devise :invitable, :database_authenticatable, :registerable, :confirmable,
:recoverable, :rememberable, :trackable, :validatable,
:encryptable, :encryptor => :sha512, :authentication_keys => [:username]
include Devise::Async::Model

And I got this error.

/home/carey/.rvm/gems/ruby-1.9.3-p125/gems/devise-async-0.3.0/lib/devise/async/model.rb:7:in block in <module:Model>': undefined methodafter_commit' for User:Class (NoMethodError)

Devise 2.1.2
I tried Devise 2.1.2 and Devise-async 0.2.0, same error.

NoMethodError - undefined method `stringify_keys!'

I'm using Devise Async with Devise 3.1.1 and Devise Invitable from master branch. No idea what the problem is and where this random string is coming from.

Getting errors like this:

NoMethodError - undefined method `stringify_keys!' for "VMZXFmtuDLWzozZir_1T":String:
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise-async-e7cfa0e8739c/lib/devise/async/worker.rb:7:in `enqueue'
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise-async-e7cfa0e8739c/lib/devise/async/model.rb:37:in `send_devise_notification'
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise_invitable-2c2b9dd59fa4/lib/devise_invitable/model.rb:158:in `deliver_invitation'
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise_invitable-2c2b9dd59fa4/lib/devise_invitable/model.rb:127:in `invite!'
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise_invitable-2c2b9dd59fa4/lib/devise_invitable/model.rb:242:in `_invite'
   () Users/allenwyma/.rvm/gems/ruby-2.0.0-p247/bundler/gems/devise_invitable-2c2b9dd59fa4/lib/devise_invitable/model.rb:247:in `invite!'
  app/controllers/users_invitations_controller.rb:18:in `create'
  actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (4.0.0) lib/active_support/callbacks.rb:463:in `_run__4065025025803335852__process_action__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
  activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
  actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
  actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/mapper.rb:44:in `call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
  meta_request (0.2.7) lib/meta_request/middlewares/app_request_handler.rb:13:in `call'
  rack-contrib (1.1.0) lib/rack/contrib/response_headers.rb:17:in `call'
  meta_request (0.2.7) lib/meta_request/middlewares/headers.rb:16:in `call'
  meta_request (0.2.7) lib/meta_request/middlewares/meta_request_handler.rb:13:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:35:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
  activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__1301040490710735377__call__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/reloader.rb:64:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  better_errors (0.9.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
  better_errors (0.9.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
  better_errors (0.9.0) lib/better_errors/middleware.rb:56:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  quiet_assets (1.0.2) lib/quiet_assets.rb:18:in `call_with_quiet_assets'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
  /Users/allenwyma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
  /Users/allenwyma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
  /Users/allenwyma/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

:async mailer not working

Hello,

I had troubles having confirmation email sent from Devise so I simply removed the :async from my model and the Devise::Async.backend = :sidekiq from the config/initializers/devise.rb and it instantly started to work again.

Of course sidekiq and Redis were running when I tested all this.
I'm using

Ruby 2.0.0dev
Rails 3.2.13
Sidekiq 2.10.0
Devise 2.2.3
Devise-async 0.7.0

Anything I'm missing or info I could post to help out?

Trying to send email before transactions end.

2012-10-09T22:30:54Z 2 TID-qeg9k WARN: {"retry"=>true, "queue"=>"mailer", "class"=>"Devise::Async::Backend::Sidekiq", "args"=>["confirmation_instructions", "User", "15"], "jid"=>"25ea8198cfc893489525f3de", "error_message"=>"Couldn't find User with id=15", "error_class"=>"ActiveRecord::RecordNotFound", "failed_at"=>"2012-10-09T22:27:37Z", "retry_count"=>4, "retried_at"=>2012-10-09 22:30:54 UTC}

Any solutions?

Devise notification queueing not working as expected (sometimes?)

Here's a situation I am facing. It's very specific to my app, but I'm pretty sure has a root cause in devise-async.

I sometimes remind users who haven't confirmed their email addresses to do so. It goes something like this (some things renamed/simplified):

class User
  def remind
    self.email_confirmation_reminder_count += 1
    send_confirmation_instructions
    save!
  end
end

then in the email template...

- if @user.email_confirmation_reminder_count > 0
  %h6 Complete your account registration.
- else
  %h6 Welcome!

Problem: Sometimes when sending the confirmation instructions in this way, @user.email_confirmation_reminder_count is 0, even though it is incremented in User#remind. Inspecting the object at the console after the email has been sent, the incrementing was indeed successful as expected. So, for some reason the User object that was accessed within the template has the value set to 0, but persisting the incremented value within User#remind was successful.

And as a reminder, this problem only happens sometimes.

A Pretty Good Theory

I've actually seen a similar phenomenon before, and I thought it might be the case here too. If it is the case here, then this is what happens:

  1. User.email_confirmation_reminder_count is incremented on the in-memory object
  2. send_confirmation_instructions creates the background job. The background job is started and finishes before step 3...
  3. The User object, with email_confirmation_reminder_count incremented, is persisted to the DB.

But That Theory Doesn't Hold With devise-async

As you may know, devise-async specifically goes to great lengths to avoid such a situation: https://github.com/mhfs/devise-async/blob/master/lib/devise/async/model.rb

Beginnings of Other Theories

Help Me

If anyone has any ideas or suggestions for what to investigate, it would be much appreciated!

Hopefully when I solve this I can contribute some documentation that will help others!

Devise + Resque + Mandrill = Receiving Timeout::Error

Output is below.

Rails 3.2.13,
Devise 2.0.0,
Devise-Async 0.5.1
Resque 1.2.5

All other mailers work just fine. It is only the Devise mailers that seem to have issues.

Configured as this tutorial:

https://github.com/plataformatec/devise/wiki/How-To:-Send-devise-emails-in-background-(Resque,-Sidekiq-and-Delayed::Job)

"failed_at"=>"2014/04/04 16:12:31 BRT", "payload"=>{"class"=>"Devise::Async::Backend::Resque", "args"=>["confirmation_instructions", "User", "46"]}, "exception"=>"Timeout::Error", "error"=>"execution expired", "backtrace"=>["/usr/lib64/ruby/1.9.1/net/smtp.rb:540:in initialize'", "/usr/lib64/ruby/1.9.1/net/smtp.rb:540:inopen'", "/usr/lib64/ruby/1.9.1/net/smtp.rb:540:in tcp_socket'", "/usr/lib64/ruby/1.9.1/net/smtp.rb:549:inblock in do_start'", "/usr/lib64/ruby/1.9.1/net/smtp.rb:549:in do_start'", "/usr/lib64/ruby/1.9.1/net/smtp.rb:519:instart'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in deliver!'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:2129:indo_delivery'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:232:in block in deliver'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:415:inblock in deliver_mail'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in block in instrument'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:ininstrument'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in instrument'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/actionmailer-3.2.13/lib/action_mailer/base.rb:413:indeliver_mail'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:232:in deliver'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/devise-async-0.5.1/lib/devise/async/backend/base.rb:15:inperform'", "/var/www/testingapp/vendor/bundle/ruby/1.9.1/gems/devise-async-0.5.1/lib/devise/async/backend/resque.rb:13:in `perform'"], "worker"=>"www.testingapp.com.br:11464:email_worker", "queue"=>"email_worker", "retried_at"=>"2014/04/16 17:20:52"}

Why is it happening?

Change ActionMailer::Base.default_url_options on runtime

Hi!

I have a problem with changing the ActionMailer::Base.default_url_options = {:host => host} on runtime.

My environment

rails (4.2.0)
sidekiq (3.3.1)
devise (3.4.1)
devise-async (0.9.0)

I have a before_action in my application_controller

class ApplicationController < ActionController::Base

  before_action :set_action_mailer_default_url_options

  private

  def set_action_mailer_default_url_options
    host = "some-logic-to-get-the-correct-host
    ActionMailer::Base.default_url_options = {:host => host}
  end

end

Now if I want to reset my password I always get the default url options, which I have specified in the environments file. If I remove the default_url_options from my environments I get an error in my sidekiq logs.

ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true

The host is always set correctly in the controller. I already debugged that. It seems that the host is not passed to sidekiq.. any idea how I can fix this?

Jobs are being en-queued but not processed

I am using

rails 4.2
devise 3.5.1
devise-async 0.10.1
sidekiq 3.4.2
redis 3.2.1 (installed redis-server 2.8.4 on ubuntu 14.04)
devise_token_auth 0.1.31 (dont think it will interfere in any way)

I have created devise_async.rb in initializers

Devise::Async.setup do |config|
  config.backend = :sidekiq
  config.queue = :default
end

Added :async in User model devise method

Modified application.rb, added the following line

config.active_job.queue_adapter = :sidekiq

Now, I am running rails c and executing the following command

User.invite!(email: '[email protected]', provider: 'email')

note: provider attribute is required cause of devise token auth (ignore that)

this is en-queuing the job correctly but not processing it. Am I missing something?

devise-async ignoring virtual attributes?

Hello, given a user model like so:

class User < ActiveRecord::Base
  attr_accessor :added_by

And setting the virtual attribute like so (quick example):

@user = User.create(... :added_by => User.find(2))

When devise-async is storing the job in delayed job, these virtual attributes are not being stored which then causes usermailer to break if these virtual attributes were expected. Was this intentional?

Thanks

Confirmable integration test failing

Hello, I'm having an issue with an integration test checking for the confirmation email to be sent. I have described the issue here. I really can't get my head around it - but I thought I'd post it here since it only appears when async is enabled and only for confirmable. Or maybe I'm missing something...

Support specifying a mailer class

I use my own mailer for Devise emails because I like to affect the layout and include image attachments (e.g. site logo). However, if I want to continue to do so while using devise-async, I need to monkeypatch the code like this in an initializer:

Devise::Async::Backend::Base.class_eval do
  def perform(method, resource_class, resource_id)
    resource = resource_class.constantize.find(resource_id)
    UserMailer.send(method, resource).deliver
  end 
end

How about allowing users to specify the mailer class with something like Devise::Async.mailer = UserMailer ?

debugging devise async

Are there any methods to better debug devise-async? it seems to not work I get sidekiq error reports without a actual trace.

Can one use the rails console to send mails true async to test what goes wrong and where? very hard to debug else

I only get this without real application code trace

A Redis::CommandError occurred in background at 2013-10-18 00:44:55 +0200 :

 EXECABORT Transaction discarded because of previous errors.
 /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis/pipeline.rb:79:in `finish'

 -------------------------------

Backtrace:

 /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis/pipeline.rb:79:in finish'  /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis/client.rb:121:inblock in call_pipeline'
 /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis/client.rb:245:in with_reconnect'  /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis/client.rb:119:incall_pipeline'
 /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis.rb:2125:in block in multi'  /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis.rb:36:inblock in synchronize'
 /usr/local/rvm/rubies/ruby-2.1.0-preview1/lib/ruby/2.1.0/monitor.rb:211:in mon_synchronize'  /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis.rb:36:insynchronize'
 /srv/books/shared/bundle/ruby/2.1.0/gems/redis-3.0.5/lib/redis.rb:2117:in multi'  /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/processor.rb:93:inblock in stats'
 /srv/books/shared/bundle/ruby/2.1.0/gems/connection_pool-1.1.0/lib/connection_pool.rb:49:in with'  /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq.rb:67:inredis'
 /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/util.rb:26:in redis'  /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/processor.rb:92:instats'
 /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/processor.rb:46:in block in process'  /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/processor.rb:83:indo_defer'
 /srv/books/shared/bundle/ruby/2.1.0/gems/sidekiq-2.15.1/lib/sidekiq/processor.rb:37:in process'  /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:inpublic_send'
 /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:25:in dispatch'  /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/calls.rb:122:indispatch'
 /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/actor.rb:322:in block in handle_message'  /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/actor.rb:416:inblock in task'
 /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/tasks.rb:55:in block in initialize'  /srv/books/shared/bundle/ruby/2.1.0/gems/celluloid-0.15.2/lib/celluloid/tasks/task_fiber.rb:13:inblock in create'


Data:

 * data: {:message=>
   {"retry"=>true,
    "queue"=>"mailer",
    "class"=>"Devise::Async::Backend::Sidekiq",
    "args"=>
     ["confirmation_instructions", "User", "2", "mJTMoQvAskUPxGuFRegF", {}],
    "jid"=>"20807982a65a94f574313ce0",
    "enqueued_at"=>1382049893.6279392}}

:sidekiq backend doesn't register worker

I think it is similar to #30

I have loads of enqueued tasks but none is processed.

The thing is that when I go to /sidekiq page I can't see any worker registered there.

Any idea?

Info:

# Gemfile.lock
rails (4.0.0)
sidekiq (2.17.2)
devise (3.2.2)
  bcrypt-ruby (~> 3.0)
  orm_adapter (~> 0.1)
  railties (>= 3.2.6, < 5)
  thread_safe (~> 0.1)
  warden (~> 1.2.3)
devise-async (0.9.0)
  devise (~> 3.2)


# route.rb
....
devise_for :users, :controllers => {:sessions => "sessions"}


# model/user.rb
class User < ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :async, :registerable, :confirmable,
           :recoverable, :rememberable, :trackable, :validatable
    has_one :consultor
    attr_accessible :username, :email, :password, :password_confirmation, :remember_me,  :name, :confirmed_at, :actived, :consultor

    def only_if_unconfirmed
      pending_any_confirmation {yield}
    end

  end


# config/initialize/devise_async.rb
Devise::Async.backend = :sidekiq
Devise::Async.enabled = true


# config/sidekiq.yml
:verbose: true
:concurrency:  25
:queues:
  - [mailer, 5]
  - [default, 5]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.