Code

all jobs with status='done' are deleted from jobqueue
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 09:17:19 +0000 (09:17 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 4 Mar 2008 09:17:19 +0000 (09:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9288 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/gosa-si-server

index 667a8f8fc1510f4f28ca7fdfafcbdddd7c1cf243..f3b7f143651a16882f276756d61a617d2fef9ae7 100755 (executable)
@@ -1086,11 +1086,26 @@ sub client_input {
 
 
 sub trigger_db_loop {
-#      my ($kernel) = $_[KERNEL];
        my ($kernel) = @_ ;
        $kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
+    $kernel->delay_set('watch_for_done_jobs', $job_queue_loop_delay); 
 }
 
+sub watch_for_done_jobs {
+    my ($kernel,$heap) = @_[KERNEL, HEAP];
+
+    my $sql_statement = "SELECT * FROM ".$job_queue_tn.
+        " WHERE status='done'";
+       my $res = $job_db->select_dbentry( $sql_statement );
+
+    while( my ($id, $hit) = each %{$res} ) {
+        my $jobdb_id = $hit->{id};
+        my $sql_statement = "DELETE FROM $job_queue_tn WHERE id='$jobdb_id'"; 
+        my $res = $job_db->del_dbentry($sql_statement);
+    }
+
+    $kernel->delay_set('watch_for_done_jobs',$job_queue_loop_delay);
+}
 
 sub watch_for_new_jobs {
        my ($kernel,$heap) = @_[KERNEL, HEAP];
@@ -1130,7 +1145,7 @@ sub watch_for_new_jobs {
                my $func_error = &send_msg_to_target($job_msg, $server_address, $GosaPackages_key, $header);
     }
 
-       $kernel->delay_set('watch_for_new_jobs',3);
+       $kernel->delay_set('watch_for_new_jobs', $job_queue_loop_delay);
 }
 
 
@@ -1437,6 +1452,7 @@ POE::Session->create(
         next_task => \&next_task,
         task_result => \&task_result,
                watch_for_new_jobs => \&watch_for_new_jobs,
+        watch_for_done_jobs => \&watch_for_done_jobs,
         create_packages_list_db => \&create_packages_list_db,
         create_fai_server_db => \&create_fai_server_db,
        }