2017-12-04 4 views
0

오래 전부터 짧은 zend framework을 사용하는이 오래된 PHP 유틸리티로 인해 막혔습니다. 시간 초과가되면 다시 시도하지 않아 문제가 발생합니다. 타임 아웃 타이머를 변경하는 것부터 최대 리다이렉트를 변경하는 것, 그리고 설정으로 할 수있는 모든 것을 다했다가 똑같은 것을 얻는다. Zend Timeout Retry

나는 일관

Fatal error: Uncaught exception 'Zend_Http_Client_Exception' with message 'Unable to read response, or response is empty'

얻고 난 충분히 그것을 시도하는 일 경우는 문제없이 작동합니다. 그것의 다만 재 시도하는 것을 얻는 것은 문제이다.

어디서 재시도 논리를 넣을 지 모르겠습니다. 내가 본

는 일부는

public function request($method = null) 
{ 
    if (! $this->uri instanceof Zend_Uri_Http) { 
     /** @see Zend_Http_Client_Exception */ 
     require_once 'Zend/Http/Client/Exception.php'; 
     throw new Zend_Http_Client_Exception('No valid URI has been passed to the client'); 
    } 

    if ($method) { 
     $this->setMethod($method); 
    } 
    $this->redirectCounter = 0; 
    $response = null; 

    // Make sure the adapter is loaded 
    if ($this->adapter == null) { 
     $this->setAdapter($this->config['adapter']); 
    } 

    // Send the first request. If redirected, continue. 
    do { 
     // Clone the URI and add the additional GET parameters to it 
     $uri = clone $this->uri; 
     if (! empty($this->paramsGet)) { 
      $query = $uri->getQuery(); 
       if (! empty($query)) { 
        $query .= '&'; 
       } 
      $query .= http_build_query($this->paramsGet, null, '&'); 

      $uri->setQuery($query); 
     } 

     $body = $this->_prepareBody(); 
     $headers = $this->_prepareHeaders(); 

     // Open the connection, send the request and read the response 
     $this->adapter->connect($uri->getHost(), $uri->getPort(), 
      ($uri->getScheme() == 'https' ? true : false)); 

     $this->last_request = $this->adapter->write($this->method, 
      $uri, $this->config['httpversion'], $headers, $body); 

     $response = $this->adapter->read(); 
     if (! $response) { 
      /** @see Zend_Http_Client_Exception */ 
      require_once 'Zend/Http/Client/Exception.php'; 
      throw new Zend_Http_Client_Exception('Unable to read response, or response is empty'); 
     } 

     $response = Zend_Http_Response::fromString($response); 
     if ($this->config['storeresponse']) { 
      $this->last_response = $response; 
     } 

나는 그것이 또한 조금에 (내 자신의 코드에) 여기

   $eventResponse = new Response($Client->Event(
       $theEvent,null)); 

       if (!$throwEventResponse->getResponseStatusOk()) { 
        $ex = new ResponseException("Unable to complete event."); 
        $ex->setErrorList($throwEventResponse->getErrorList()); 
        throw $ex; 
       } 

임 갈 수있다 생각했다 여기 어딘가에 (Zend_http_client) 갈 것이라고 말한다 손실에 대해 어떻게해야 최선의 노력을해야할지 모르겠습니다.

미리 감사드립니다.

+0

어떤 파일이고 어떤 줄에서 오류가 발생합니까? –

+0

파일은 무작위 PDF 파일입니다. 그 이벤트 응답을 호출 할 때 (이것은 단지 파일 이름을 읽고 폴더를 만드는 데 사용합니다.이 멀티 플렉스 시간을 다시 시도하면 폴더가 무수히 실패한 후에 만 ​​생성됩니다 – iDaRkkO

답변

0

HTML 1.1에서 1.0으로 HTTP 요청 유형을 변경하면 이전 호출이 완료 될 때까지 기다리지 않고 다음 호출로 이동하면서 발생했던 문제가 해결되었습니다.

다른 요청이 완료되기 전에 두 번째 요청을 푸시하면 이상한 캐싱 문제가 발생하고 요청이 실패했습니다.