|
Lines 656-661
sub get_timeout {
Link Here
|
| 656 |
} |
656 |
} |
| 657 |
} |
657 |
} |
| 658 |
|
658 |
|
|
|
659 |
=head2 pre_loop_hook |
| 660 |
|
| 661 |
This hook is called before the main server loop starts. |
| 662 |
We use it to periodically check if we're at max_servers capacity and log a warning. |
| 663 |
|
| 664 |
=cut |
| 665 |
|
| 666 |
sub pre_loop_hook { |
| 667 |
my $self = shift; |
| 668 |
|
| 669 |
# Only check in the parent process |
| 670 |
return unless $self->is_parent; |
| 671 |
|
| 672 |
# Limit checks to once per second to avoid excessive logging |
| 673 |
state $last_check = 0; |
| 674 |
return if time - $last_check < 1; |
| 675 |
$last_check = time; |
| 676 |
|
| 677 |
my $server_props = $self->{server}; |
| 678 |
my $max_servers = $server_props->{max_servers}; |
| 679 |
my $current_children = scalar keys %{$server_props->{children} // {}}; |
| 680 |
|
| 681 |
if ($max_servers && $current_children >= $max_servers) { |
| 682 |
siplog('LOG_WARNING', "SIPServer at maximum capacity: %d/%d child processes running", $current_children, $max_servers); |
| 683 |
} |
| 684 |
} |
| 685 |
|
| 659 |
1; |
686 |
1; |
| 660 |
|
687 |
|
| 661 |
__END__ |
688 |
__END__ |
| 662 |
- |
|
|