From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: * X-Spam-ASN: AS33070 50.56.128.0/17 X-Spam-Status: No, score=1.0 required=3.0 tests=AWL,HK_RANDOM_FROM, MSGID_FROM_MTA_HEADER,TVD_RCVD_IP shortcircuit=no autolearn=no version=3.3.2 Path: news.gmane.org!not-for-mail From: Eric Wong Newsgroups: gmane.comp.lang.ruby.rainbows.general Subject: Re: background threads Date: Mon, 18 Jun 2012 22:42:45 +0000 Message-ID: <20120618224245.GA1830@dcvr.yhbt.net> References: <4FDF7420.7030300@objectdata.com.br> <20120618215550.GA31162@dcvr.yhbt.net> <4FDF81A5.6080605@objectdata.com.br> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1340059372 17528 80.91.229.3 (18 Jun 2012 22:42:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2012 22:42:52 +0000 (UTC) Cc: Alexandre Riveira To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Original-X-From: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Tue Jun 19 00:42:51 2012 Return-path: Envelope-to: gclrrg-rainbows-talk@m.gmane.org X-Original-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Delivered-To: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Content-Disposition: inline In-Reply-To: <4FDF81A5.6080605-VwDbj2YsoUp0ZRtCdD4y8VAUjnlXr6A1@public.gmane.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Errors-To: rainbows-talk-bounces-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org Xref: news.gmane.org gmane.comp.lang.ruby.rainbows.general:364 Archived-At: Received: from 50-56-192-79.static.cloud-ips.com ([50.56.192.79] helo=rubyforge.org) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Sgkeo-0004Fm-2f for gclrrg-rainbows-talk@m.gmane.org; Tue, 19 Jun 2012 00:42:50 +0200 Received: from localhost.localdomain (localhost [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 182CB2E070; Mon, 18 Jun 2012 22:42:50 +0000 (UTC) Received: from dcvr.yhbt.net (dcvr.yhbt.net [64.71.152.64]) by rubyforge.org (Postfix) with ESMTP id 8C2812E06E for ; Mon, 18 Jun 2012 22:42:46 +0000 (UTC) Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 051381F464; Mon, 18 Jun 2012 22:42:46 +0000 (UTC) Alexandre Riveira wrote: > Em 18-06-2012 21:55, Eric Wong escreveu: > >So for background threads, I prefer to start it in the app stack > >on the first request (use a mutex to protect against double-starts). > >For rails, you can probably do it in a before_filter. > > Eric, how do you ensure the application does not create a thread for > each worker In the Raindrops::Watcher case, I don't. Watcher works as a single process and doesn't need/care about multiple background threads. If you only want one background thread for all workers, it probably is best to just use a separate daemon independent of the Rainbows! server. _______________________________________________ Rainbows! mailing list - rainbows-talk-GrnCvJ7WPxnNLxjTenLetw@public.gmane.org http://rubyforge.org/mailman/listinfo/rainbows-talk Do not quote signatures (like this one) or top post when replying