delayed-job

Rails server hangs when started with foreman

僤鯓⒐⒋嵵緔 提交于 2019-12-07 10:35:34
Here's what my Procfile looks like: web: bundle exec rails server thin -p $PORT -e $RACK_ENV worker: bundle exec rake jobs:work I intend to add a worker process because I wish to run some background jobs. I'm following these instructions This is what I noticed: No problems encountered if the worker is started separately. When I keep the second line in the Procfile and don't not change anything else, the rails server serves a couple of requests and hangs after that As mentioned here , I've added STDOUT.sync = true to config/environments/development.rb and verified the same in the rails console.

NoMethodError with delayed_job (collectiveidea gem)

妖精的绣舞 提交于 2019-12-06 19:43:35
问题 UPDATE: There's been a patch for this issue: https://github.com/collectiveidea/delayed_job/commit/023444424166ba2ce011bfe2d47954e79edf6798 UPDATE 2: For anyone running into this issue on Heroku specifically, I've found downgrading to Rake 0.8.7 and using Delayed Job version 2.1.4 works, while delayed job v3 does not (though with the patch it does work on local). This is on the Bamboo-mri-1.9.2 stack. I am trying to implement delayed_job on a rails 3.1.0 app locally. I ran the migration and

Delayed_job in rails failing

女生的网名这么多〃 提交于 2019-12-06 12:59:47
问题 I am just beginning to look into using the delayed_job gem. To test it, I added "delayed" to the welcome email function and changed that call from UserMailer.welcome_email(self).deliver to UserMailer.delay.welcome_email(self) This is called inside the User model after_create. I see an entry show up in the delayed_job table after the function executes. Now when I run "rake jobs:work" on command line the task starts but gives errors as below [Worker(host:Sanjay-PC pid:7008)] Starting job worker

Rails: Delayed Job --> Not picking up 'from' field when sending asynchronous mail

十年热恋 提交于 2019-12-06 06:39:37
问题 I'm running 2.1.1, Rails 3, and having a heckuva time getting the delayed_job gem working. If I strip out handle_asynchronously on a mailer, everything works fine...but if I put it back in, I get: undefined method `name' for nil:NilClass (where 'name' comes from @contact.name ...which works fine when handle_asynchronously is disabled). If I strip out all the @contact template info, I get: "A sender (Return-Path, Sender or From) required to send a message"? Is this me doing something wrong or

Rails 3: Return large amount of data to user via API

蓝咒 提交于 2019-12-06 06:35:06
My app has an API that users can request data. Sometimes that data takes time to process and is breaking my code. I need a solution for this and I was thinking in using delayed_job but I'm not sure how this works. If the user makes a request, I need to give him an answer. Even if I process the data in background, the call still needs to wait until the job returns. What is the solution for this? I am not sure how to do it. Thanks Heroku has a 30 second timeout , which is why your requests are failing (Probably H12 or H13 in your heroku logs). There are three methods to work around this. Keep

PaperTrail: info_for_paper_trail outside the context of a controller

孤者浪人 提交于 2019-12-06 06:18:29
问题 I am using the paper_trail gem for versioning my models. So far, my model depends on the info_for_paper_trail method in ApplicationController : class ApplicationController < ActionController::Base # Extra columns to store along with PaperTrail `versions` def info_for_paper_trail { revision_id: @revision.id, revision_source_id: @revision_source.id } end end This works great in context of the controller, but is there a way that I can replicate this sort of thing outside the context of the

Delayed_job Won't Run User defined method

家住魔仙堡 提交于 2019-12-06 05:52:02
I have been trying to get DelayedJob to run some user defined methods in the background. For this test case I defined the following method in a helper: def test_case u = User.new u.first_name = "JimBob" u.last_name = "joe" u.email = "itworked@eureka.com" u.password = "sailsJ123" u.password_confirmation = "sailsJ123" u.save end Then, in a controller action, I define: def action_name #whatever it does outside of this test_case end This causes test_case to create a new user when the action here is run. If I try to delay the job, I change it to: def action_name #whatever it does outside of this

Net::SSH works from production rails console, AuthenticationFailed from production webapp

跟風遠走 提交于 2019-12-06 05:19:35
I have a rails app where a user can submit a form and it goes off and connects to a remote server via ssh to call a script. Eventually I plan to use delayed_job or something like that but I can't get it to work in production with even a simple test. The odd thing is, Net::SSH works just fine from the console in production, but it fails with AuthenticationFailed when I submit the form in production. Both the console and the webapp work fine in development. The error: Net::SSH::AuthenticationFailed (my_ssh_username): app/models/branch.rb:69:in `ssh_to_machine' app/controllers/branches_controller

Terminal says delayed_job starting, but not doing anything

荒凉一梦 提交于 2019-12-06 04:37:29
I have an app that works perfectly on my local machine and am deploying it now. I have the VPS all set up and it pretty much works, as well. My problem comes from not being able to start delayed_job. I do the "ruby script/delayed_job start RAILS_ENV=production" while SSHd to the app and it returns "delayed_job: process with pid 11547 started." When I look for the process in htop, I can't find it. So I dug around and read that Monit can keep delayed_job going. I set that up, hoping I could start up the delayed_job that way. There's no delayed_job.pid, though, so I didn't get far. I ended up

delayed_job: 'undefined method' error when using handle_asynchronously

坚强是说给别人听的谎言 提交于 2019-12-06 04:05:14
I'm attempting to use delayed_job to run a larger csv import into my rails database. Here are my controller and model methods: controller method def import InventoryItem.import(params[:file], params[:store_id]) redirect_to vendors_dashboard_path, notice: "Inventory Imported." end model method def self.import(file, store_id) CSV.foreach(file.path, headers: true) do |row| inventory_item = InventoryItem.find_or_initialize_by_upc_and_store_id(row[0], store_id) inventory_item.update_attributes(:price => row.to_hash["price"], :updated_at => "#{Time.now}") end end handle_asynchronously :import I've