2017-12-04 4 views
0

長い話が短いので、私は古いzendフレームワークを使用しているこの古いPHPユーティリティに悩まされていました。私はそれがタイムアウトするときにそれが失敗するように再試行しないときに問題を抱えています。タイムアウトタイマーを変更することから最大リダイレクトを変更すること、そして設定で行うことができ、それでも同じことをすることまで、すべてを行ってきました。 Zend Timeout Retry

は、私は一貫し

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

取得し、私は十分にそれを試して起こる場合には問題なく動作します。再試行するのが問題です。

リトライロジックを配置する場所がわからない。

私はイムは少しで

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

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

いくつかは、私はそれはまた、(私自身のコードで)ここに行く可能性が考えていた

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; 
     } 

(Zend_Http_Clientで)それがどこかにここに行くと言って見てきました

私が必要とするもののために最善の仕事をする方法についてはわかりません。

ありがとうございます!

+0

どのファイルがそのエラーを示していますか? –

+0

ファイルは無作為なpdfです。彼はイベントの応答を呼び出すとき(これはちょうどファイル名を読み取り、それを使用してフォルダを作成します。このマルチプル時間を再試行すると、フォルダは何回も失敗した後にのみ作成されます – iDaRkkO

答えて

0

HTTPリクエストのタイプをHTML 1.1から1.0に変更すると、以前の呼び出しが終了するのを待つことなく、次の呼び出しに移動していた問題が修正されています。

もう一方の要求が実行される前にプッシュすると、奇妙なキャッシングの問題が発生し、要求は失敗しました。