Skip to content

Commit

Permalink
lib: fixed removing handle when error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
tflanagan committed Apr 14, 2016
1 parent c4514df commit 00a4c68
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions quickbase.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,21 @@ final public function api($action, $options = array()){
}while($running > 0);

for($i = 0; $i < $nActions; ++$i){
$queries[$i]
->processCH()
->checkForAndHandleError()
->actionResponse()
->finalize();
try {
$queries[$i]
->processCH()
->checkForAndHandleError()
->actionResponse()
->finalize();

$results[] = $queries[$i]->response;
$results[] = $queries[$i]->response;

curl_multi_remove_handle($this->mch, $this->chs[$i]);
curl_multi_remove_handle($this->mch, $this->chs[$i]);
}catch(\Exception $err){
curl_multi_remove_handle($this->mch, $this->chs[$i]);

throw $err;
}
}

if($nActions === 1){
Expand Down Expand Up @@ -354,7 +360,7 @@ final public function processCH(){

$headerSize = curl_getinfo($this->ch, CURLINFO_HEADER_SIZE);

if($response === false){
if($response === false || $response === ''){
++$this->nErrors;

if($this->nErrors <= $this->settings['maxErrorRetryAttempts']){
Expand Down

0 comments on commit 00a4c68

Please sign in to comment.