Code

move 'get ldap handle from pool' from sub process_task to sub watch_for_next_tasks
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Mar 2009 14:34:49 +0000 (14:34 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 11 Mar 2009 14:34:49 +0000 (14:34 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13529 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server

index 17483bb6973b6a7a773404e37d7529eceb31b94f..a6daf3fe11c0202a8767961dbb0858fcc11a3bc2 100755 (executable)
@@ -1325,8 +1325,7 @@ sub msg_to_decrypt {
 
 
 sub next_task {
-    my ($session, $heap, $task) = @_[SESSION, HEAP, ARG0];
-       my $ldap_handle = &get_ldap_handle();
+    my ($session, $heap, $task, $ldap_handle) = @_[SESSION, HEAP, ARG0, ARG1];
     my $running_task = POE::Wheel::Run->new(
             Program => sub { process_task($session, $heap, $task, $ldap_handle) },
             StdioFilter => POE::Filter::Reference->new(),
@@ -2125,7 +2124,10 @@ sub watch_for_next_tasks {
         my $message_id = $hit->{'id'};
         my $session_id = $hit->{'sessionid'};
         &daemon_log("$session_id DEBUG: start processing for message with incoming id: '$message_id'", 7);
-        $kernel->yield('next_task', $hit);
+
+               my $ldap_handle = &get_ldap_handle();
+               if (not defined $ldap_handle) { next; }
+        $kernel->yield('next_task', $hit, $ldap_handle);
 
         my $sql = "DELETE FROM $incoming_tn WHERE id=$message_id";
         my $res = $incoming_db->exec_statement($sql);
@@ -2802,15 +2804,7 @@ sub create_packages_list_db {
        }
 
        if (not defined $session_id) { $session_id = 0; }
-#      if (not defined $ldap_handle) { 
-#              $ldap_handle= &get_ldap_handle();
-#
-#              if (not defined $ldap_handle) {
-#                      daemon_log("$session_id ERROR: no ldap_handle available to create_packages_list_db", 1);
-#                      unlink($packages_list_under_construction);
-#                      return;
-#              }
-#      }
+
        if (not defined $sources_file) { 
                &main::daemon_log("$session_id INFO: no sources_file given for creating packages list so trigger creation of it", 5); 
                $sources_file = &create_sources_list($session_id);