From: Eric Wong <normalperson@yhbt.net>
To: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: Using a worker for a different purpose
Date: Thu, 7 Jan 2010 20:26:32 +0000 [thread overview]
Message-ID: <20100107202632.GB27432@dcvr.yhbt.net> (raw)
In-Reply-To: <201001071635.56191.ibc@aliax.net>
Iñaki Baz Castillo <ibc@aliax.net> wrote:
> Hi, I'm thinking in using a worker (i.e: "worker.nr == 0") to accomplish a
> diferent task than binding in the Unicorn socket.
>
> It would behave as a different process which binds in a different socket as
> daemon, so the other workers would notify it after processing data.
>
> Of course I could have a separate process but why not using an Unicorn worker
> for this? in this way it's automatically reaped by master process if it
> crashes and I don't need to manage two different services.
>
> Is is suitable? The main question is: how to tell a worker not to bind in the
> Unicorn configured socket(s)? is it possible?
Hi Iñaki,
You could _try_ something like:
after_fork do |server, worker|
if worker.nr == 0
# new app
server.app = Rack::Builder.new { ... }
# clear the local listener set
server.listeners = []
# new listeners
server.listen another_socket, socket_options
end
end
I make no guarantees that it'll work, though, and I'm hesitant
to support/encourage it even if it does.
--
Eric Wong
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying
next prev parent reply other threads:[~2010-01-07 20:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-07 15:35 Using a worker for a different purpose Iñaki Baz Castillo
2010-01-07 20:26 ` Eric Wong [this message]
2010-01-07 20:44 ` Iñaki Baz Castillo
2010-01-07 20:53 ` Eric Wong
2010-01-07 20:58 ` Iñaki Baz Castillo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://yhbt.net/unicorn/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100107202632.GB27432@dcvr.yhbt.net \
--to=normalperson@yhbt.net \
--cc=mongrel-unicorn@rubyforge.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhbt.net/unicorn.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).