public function handle_unexpected_shutdown()
 {
     if ($error = error_get_last()) {
         if ($error['type'] == E_ERROR) {
             if (!empty($this->action_id)) {
                 $this->store->mark_failure($this->action_id);
                 do_action('action_scheduler_unexpected_shutdown', $this->action_id, $error);
             }
         }
         $this->store->release_claim($this->claim);
     }
 }
 public function handle_unexpected_shutdown()
 {
     if ($error = error_get_last()) {
         if (in_array($error['type'], array(E_ERROR, E_PARSE, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
             if (!empty($this->action_id)) {
                 $this->store->mark_failure($this->action_id);
                 do_action('action_scheduler_unexpected_shutdown', $this->action_id, $error);
             }
         }
         $this->store->release_claim($this->claim);
     }
 }
 protected function do_batch($size = 100)
 {
     $claim = $this->store->stake_claim($size);
     $this->monitor->attach($claim);
     $processed_actions = 0;
     foreach ($claim->get_actions() as $action_id) {
         // bail if we lost the claim
         if (!in_array($action_id, $this->store->find_actions_by_claim_id($claim->get_id()))) {
             break;
         }
         $this->process_action($action_id);
         $processed_actions++;
     }
     $this->store->release_claim($claim);
     $this->monitor->detach();
     $this->clear_caches();
     return $processed_actions;
 }