示例#1
0
 /**
  * Handle the analysis has completed event.
  *
  * We have a 1 in 8 chance of performing a cleanup.
  *
  * @param \StyleCI\StyleCI\Events\Analysis\AnalysisHasCompletedEvent $event
  *
  * @return void
  */
 public function handle(AnalysisHasCompletedEvent $event)
 {
     if (random_int(0, 7) > 0) {
         return;
     }
     foreach (Analysis::old()->pending()->orderBy('created_at', 'asc')->get() as $analysis) {
         $this->dispatch(new CleanupAnalysisJob($analysis));
     }
 }