Forum: Ruby on Rails BackgroundRB - not listening to mongrel/nginx

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2008-11-10 12:58
I'm trying to get backgroundrb set up and working but i have a problem
getting it to listen to our server.  It works for me locally, with these
settings -

---
:backgroundrb:
  :ip: 0.0.0.0
  :port: 11006
  :environment: development
  :persistent_delay: 10

The problem is trying to get it working on our server.  I'm trying it on
our 'staging' environment, with these settings:

---
:backgroundrb:
  :ip: 0.0.0.0
  :port: 11006
  :environment: staging
  :persistent_delay: 10

I start it with
sudo ./script/backgroundrb start -e staging

and it is running - i can see, in the log file, the bdrb_job_queues
table being checked every 10 seconds.  But, when i try to make a call to
it from the app, the background worker is called from my code but
nothing happens: it looks like backgroundrb just doesn't hear the
request.

I suspect it might be to do with the ip and/or port setting - i tried
changing the ip to 127.0.0.1 but that didn't help.  We use an nginx
server with a mongrel cluster beneath, and my knowledge of how they
communicate re ip addresses and ports is pretty much nonexistent.  Can
anyone help?

thanks
max
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2008-11-10 16:44
I fixed this, it was a dumb error on my part to do with how i was
testing it.  In the process i worked out how to write to a custom log
file from backgroundrb (this showed me what i was doing wrong).
D3fc5887a2f39f2e0c8989d39ce5e6f9?d=identicon&s=25 Bharat Ruparel (bruparel)
on 2008-11-10 21:00
Great work Max.  Do you want to share with us what you did to create a
custom log and actual troubleshooting process?
Thanks.
Bharat
73c04e9ef9ca435c5b19a2e765ae6d20?d=identicon&s=25 Max Williams (max-williams)
on 2008-11-11 10:13
Bharat Ruparel wrote:
> Great work Max.  Do you want to share with us what you did to create a
> custom log and actual troubleshooting process?
> Thanks.
> Bharat

Yeah - in the worker class:

class LmailWorker < BackgrounDRb::MetaWorker
  set_worker_name :lmail_worker
  @@logger = Logger.new("log/backgroundrb_custom.log")

  def ldb(debug_text)
    @@logger.info "### #{caller[0]}: #{debug_text}"
  end

  def create(args = nil)
    # this method is called, when worker is loaded for the first time
    ldb "created LmailWorker"
  end
end

Example logger output -
###
/var/www/apps/e_learning_staging/releases/20081110183756/lib/workers/lmail_worker.rb:11:in
`create': created LmailWorker

This only gets me some of the way actually.  I have two workers - one of
them responds, the other doesn't, and i don't get any useful information
from the one that doesn't respond.  I can;t think of a way to diagnose
the problem :/
This topic is locked and can not be replied to.