Changeset 710

Show
Ignore:
Timestamp:
10/12/07 12:12:04 (2 years ago)
Author:
marksmith
Message:

shutdown graceful [timeout]

Now accepts timeout before doing a hard shutdown. Patch by Jonty Wareing.

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/CHANGES

    r708 r710  
     1    -- SHUTDOWN GRACEFUL [timeout] - now accepts optional timeout 
     2       parameter to force shutdown after that period in seconds 
     3 
    14    -- make SSL non-blocking 
    25 
  • trunk/lib/Perlbal.pm

    r704 r710  
    385385 
    386386sub MANAGE_shutdown { 
    387     my $mc = shift->parse(qr/^shutdown( graceful)?$/); 
     387    my $mc = shift->parse(qr/^shutdown(\s?graceful)?\s?(\d+)?$/); 
    388388 
    389389    # immediate shutdown 
     
    418418        return 0; # end the event loop and thus we exit perlbal 
    419419    }); 
     420 
     421    # If requested, register a callback to kill the perlbal process after a specified number of seconds 
     422    if (my $timeout = $mc->arg(2)) { 
     423        Perlbal::Socket::register_callback($timeout, sub { exit(0); }); 
     424    } 
    420425 
    421426    # so they know something happened