make @perl_services and @nonperl_services have the same structure
authorGalen Charlton <gmc@esilibrary.com>
Fri, 6 Feb 2015 15:30:20 +0000 (15:30 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 6 Feb 2015 15:30:20 +0000 (15:30 +0000)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
bin/opensrf-perl.pl.in

index a169070..82123af 100755 (executable)
@@ -117,7 +117,7 @@ my $PY_COMMAND = "opensrf.py -f $opt_config -p $opt_pid_dir ". ($opt_localhost ?
 sub verify_services {
     my $service = shift;
     return 1 if $service and $service eq 'router';
-    my @services = (@perl_services, map {$_->{service}} @nonperl_services);
+    my @services = map {$_->{service}} (@perl_services, @nonperl_services);
     if (@services) {
         return 1 unless $service;
         return 1 if grep { $_ eq $service } @services;
@@ -228,8 +228,7 @@ sub do_diagnostic {
 
     my @conf_services;
     if ($alive) {
-        @conf_services = (@perl_services, 
-            map {$_->{service}} @nonperl_services);
+        @conf_services = map {$_->{service}} (@perl_services, @nonperl_services);
     }
     
     my @services;
@@ -341,10 +340,12 @@ sub do_init {
                 next;
             }
             my $lang = $sclient->config_value('apps', $app, 'language') || '';
+            my $max_drones = $sclient->config_value('apps', $app, 'unix_config', 'max_children') || 0;
+            my $min_drones = $sclient->config_value('apps', $app, 'unix_config', 'min_children') || 0;
             if ($lang =~ /perl/i) {
-                push(@perl_services, $app);
+                push(@perl_services,    {service => $app, lang => $lang});
             } else {
-                push(@nonperl_services, {service => $app, lang => $lang});
+                push(@nonperl_services, {service => $app, lang => $lang, max_drones => $max_drones});
             }
         }
     }
@@ -387,7 +388,7 @@ sub do_start {
 
     load_settings() if $service eq 'opensrf.settings';
 
-    if(grep { $_ eq $service } @perl_services) {
+    if(grep { $_->{service} eq $service } @perl_services) {
         return unless do_daemon($service);
         OpenSRF::System->run_service($service, $opt_pid_dir);
 
@@ -420,7 +421,7 @@ sub do_start_all {
 sub do_start_services {
     msg("starting services for $hostname");
 
-    if(grep {$_ eq 'opensrf.settings'} @perl_services) {
+    if(grep {$_->{service} eq 'opensrf.settings'} @perl_services) {
         do_start('opensrf.settings');
         # in batch mode, give opensrf.settings plenty of time to start 
         # before any non-Perl services try to connect
@@ -428,7 +429,7 @@ sub do_start_services {
     }
 
     # start Perl services
-    for my $service (@perl_services) {
+    for my $service (map {$_->{service}} @perl_services) {
         do_start($service) unless $service eq 'opensrf.settings';
     }