On Feb 25, 2012, at 3:39 AM, Tomas Doran wrote:
>>> Or maybe there's a reason why there's not an obvious hook and someone can 
>>> point me to the pitfalls I'm not seeing.
> 
> It's not totally obvious as you can't do this at process startup (as you then 
> fork!),

Yeah, I just realized that that was going to be an issue when I went to attempt 
this (late yesterday).

> so it has to be done in the FCGI process manager really (which does the 
> forking)…
> 
> You can subclass FCGI::ProcManager and implement:
> 
> sub handling_init {
>    my $self = shift;
>    $self->next::method(@_);
>    MyApp->model('DB')->schema->dbh->ping; # Check we have a DB connection 
> that's working straight after forking but before starting to handle requests.
> }
> 
> You can then pass your fastcgi.pl script the option to use your custom 
> process manager, and you're sorted.

Perfect, thanks!

--
Daniel J. Luke                                                                  
 
+========================================================+                      
  
| *---------------- dl...@geeklair.net ----------------* |                      
    
| *-------------- http://www.geeklair.net -------------* |                      
    
+========================================================+                      
  
|   Opinions expressed are mine and do not necessarily   |                      
    
|          reflect the opinions of my employer.          |                      
    
+========================================================+




_______________________________________________
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Reply via email to