Skip to content
Permalink
Browse files

Fix to bugreport #887

The newly introduced looping through the result set continues looping until it receives the full result.
There was a case that lead to an endless loop, if the BVFS API delivers a rubish result.

Fixes #887: Restore file list taking 20 minutes to populate
  • Loading branch information...
fbergkemper committed Jan 4, 2018
1 parent eac1f95 commit a562e5fee9adc19ebdec86c4f75f9ee6bd7f5d86
Showing with 3 additions and 2 deletions.
  1. +1 −0 CHANGELOG.md
  2. +2 −2 module/Restore/src/Restore/Model/RestoreModel.php
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Added

### Changed
- Fix to bugreport #887

### Removed

@@ -64,7 +64,7 @@ public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
$cmd_2 = '.bvfs_lsdirs jobid='.$jobid.' path=@ limit='.$limit;
$result = $bsock->send_command($cmd_2, 2, $jobid);
$directories = \Zend\Json\Json::decode($result, \Zend\Json\Json::TYPE_ARRAY);
if(count($directories['result']['directories']) == 2) {
if(count($directories['result']['directories']) <= 2) {
$retval = array_merge($retval, $directories['result']['directories']);
// as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
foreach($retval as $key => $value) {
@@ -78,7 +78,7 @@ public function getDirectories(&$bsock=null, $jobid=null, $pathid=null) {
}
}
// no more results?
elseif (count($directories['result']['directories']) == 2) {
elseif (count($directories['result']['directories']) <= 2) {
$retval = array_merge($retval, $directories['result']['directories']);
// as . and .. are always returned, filter possible duplicates of . and .. (current and parent dir)
foreach($retval as $key => $value) {

0 comments on commit a562e5f

Please sign in to comment.
You can’t perform that action at this time.