Skip to content

Commit 00a4c68

Browse files
committed
lib: fixed removing handle when error occurs
1 parent c4514df commit 00a4c68

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

quickbase.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,21 @@ final public function api($action, $options = array()){
111111
}while($running > 0);
112112

113113
for($i = 0; $i < $nActions; ++$i){
114-
$queries[$i]
115-
->processCH()
116-
->checkForAndHandleError()
117-
->actionResponse()
118-
->finalize();
114+
try {
115+
$queries[$i]
116+
->processCH()
117+
->checkForAndHandleError()
118+
->actionResponse()
119+
->finalize();
119120

120-
$results[] = $queries[$i]->response;
121+
$results[] = $queries[$i]->response;
121122

122-
curl_multi_remove_handle($this->mch, $this->chs[$i]);
123+
curl_multi_remove_handle($this->mch, $this->chs[$i]);
124+
}catch(\Exception $err){
125+
curl_multi_remove_handle($this->mch, $this->chs[$i]);
126+
127+
throw $err;
128+
}
123129
}
124130

125131
if($nActions === 1){
@@ -354,7 +360,7 @@ final public function processCH(){
354360

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

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

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

0 commit comments

Comments
 (0)