| Lines 124-146
          while (1) {
      
      
        Link Here | 
        
          | 124 |             return; | 124 |             return; | 
        
          | 125 |         }; | 125 |         }; | 
        
          | 126 |  | 126 |  | 
          
            
              | 127 |         my $job; | 127 |         unless ( $args ) { | 
            
              | 128 |  | 128 |             Koha::Logger->get({ interface => 'worker' })->warn(sprintf "Frame does not have correct args, ignoring it"); | 
            
              | 129 |         if ($args) { | 129 |             $conn->nack( { frame => $frame, requeue => 'false' } ); | 
            
              | 130 |             $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; | 130 |             next; | 
            
              | 131 |             unless ($job) { | 131 |         } | 
            
              | 132 |                 Koha::Logger->get( { interface => 'worker' } ) | 132 |  | 
            
              | 133 |                     ->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); | 133 |         my $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; | 
            
              | 134 |  | 134 |         unless ($job) { | 
            
              | 135 |                 # nack to force requeue | 135 |             Koha::Logger->get( { interface => 'worker' } ) | 
            
              | 136 |                 $conn->nack( { frame => $frame, requeue => 1 } ); | 136 |                 ->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); | 
            
              | 137 |                 Time::HiRes::sleep(0.5); | 137 |  | 
            
              | 138 |                 next; | 138 |             # nack to force requeue | 
            
              | 139 |             } | 139 |             $conn->nack( { frame => $frame, requeue => 'true' } ); | 
            
              | 140 |             $conn->ack( { frame => $frame } ); | 140 |             Time::HiRes::sleep(0.5); | 
            
              | 141 |         } else { |  |  | 
        
          | 142 |             next; | 141 |             next; | 
        
          | 143 |         } | 142 |         } | 
            
              |  |  | 143 |         $conn->ack( { frame => $frame } ); | 
        
          | 144 |  | 144 |  | 
        
          | 145 |         $pm->start and next; | 145 |         $pm->start and next; | 
        
          | 146 |         srand();    # ensure each child process begins with a new seed | 146 |         srand();    # ensure each child process begins with a new seed | 
            
              | 147 | -  |  |  |