Skip to content
This repository has been archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Fix to bugreport #887
Browse files Browse the repository at this point in the history
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 a562e5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions module/Restore/src/Restore/Model/RestoreModel.php
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit a562e5f

Please sign in to comment.