Permalink
Browse files

Queue jobs instead of direct invocation

  • Loading branch information...
1 parent c9f8794 commit 2ac451709af2a8f1ee652f9246bccf08cb4e1a86 @rwdaigle committed May 23, 2012
Showing with 6 additions and 5 deletions.
  1. +1 −1 Procfile
  2. +2 −2 app/controllers/emails_controller.rb
  3. +3 −2 lib/tasks/ptls.rake
View
@@ -1,3 +1,3 @@
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
-#worker: bundle exec rake qc:work
+worker: bundle exec rake qc:work
#clock: bundle exec clockwork clock.rb
@@ -3,8 +3,8 @@ class EmailsController < ApplicationController
skip_before_filter :verify_authenticity_token, :login_required
def create
- InboundEmailLoader.load!(params['from'], params["subject"])
- # $queue.enqueue('InboundEmailLoader.load!', params['from'], params["subject"])
+ # InboundEmailLoader.load!(params['from'], params["subject"])
+ $queue.enqueue('InboundEmailLoader.load!', params['from'], params["subject"])
render :text => "OK"
end
end
View
@@ -8,8 +8,9 @@ namespace :ptls do
desc "Load words from external sources"
task :load => :environment do
- [WordnikWODLoader, CSVLoader].each do |klass|
- klass.load!
+ [WordnikWODLoader].each do |klass| # CSVLoader
+ $queue.enqueue("#{klass.to_s}.load!")
+ # klass.load!
end
end
end

0 comments on commit 2ac4517

Please sign in to comment.