Commit 7dd0f3cda475b832d97d3668fe18db3fb8d06f0c
1 parent
1e106ce5
Exists in
master
and in
109 other branches
Fix bug when a regristry returns a timeout error.
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
php/classes/VOTableMgr.php
... | ... | @@ -32,6 +32,7 @@ class VOTableMgr { |
32 | 32 | { |
33 | 33 | $this->is_little_endian = array_values(unpack('L1L', pack('V', 1)))[0] == 1; |
34 | 34 | |
35 | + libxml_set_streams_context(stream_context_create([ 'http' => [ 'method' => 'GET', 'timeout' => '5' ]])); | |
35 | 36 | // BRE - Add proxy host if exists |
36 | 37 | $context = ProxyUtils::getStreamContextWithProxy(); |
37 | 38 | if (isset($context)) { |
... | ... | @@ -464,7 +465,6 @@ class VOTableMgr { |
464 | 465 | } |
465 | 466 | $data = Array(); |
466 | 467 | $fields = $this->xp->query($this->queryFields()); |
467 | - $resource = $this->xp->query($this->queryResource()); | |
468 | 468 | $nb_columns = $fields->length; |
469 | 469 | $row = Array(); |
470 | 470 | $n_value = 0; // index of current value |
... | ... |
php/epntap.php
... | ... | @@ -96,8 +96,9 @@ function getServices() { |
96 | 96 | |
97 | 97 | $regNumber = 0; |
98 | 98 | $r = []; |
99 | - $lastErrorMessage = null; | |
100 | - for(; $regNumber<count($registriesURL) ; $regNumber++) { | |
99 | + $lastErrorMessage = ''; | |
100 | + for(; $regNumber < count($registriesURL) ; $regNumber++) { | |
101 | + error_log('trying ' . $registriesURL[$regNumber] . '...'); | |
101 | 102 | $r = request($registriesURL[$regNumber], $query); |
102 | 103 | if($r['success']) { |
103 | 104 | // Add several other parameters and remove AMDA |
... | ... | @@ -115,12 +116,13 @@ function getServices() { |
115 | 116 | } |
116 | 117 | break; |
117 | 118 | } else { |
118 | - $lastErrorMesage = 'Last tried registry (' . $registriesURL[$regNumber] . ') returned this error: ' . $r['msg'] . '.'; | |
119 | + $lastErrorMesage = $registriesURL[$regNumber] . ' returned this error: ' . $r['msg'] . '.'; | |
120 | + error_log($lastErrorMesage); | |
119 | 121 | } |
120 | 122 | } |
121 | 123 | |
122 | 124 | if(!$r['success']) { |
123 | - $r['msg'] = 'Can not access any of these registries: ' . implode(', ', $registriesURL) . ', last error message is ' . $lastErrorMessage; | |
125 | + $r['msg'] = 'Can not access registry: ' . $lastErrorMessage; | |
124 | 126 | } |
125 | 127 | return $r; |
126 | 128 | } |
... | ... |