Skip to content

Commit

Permalink
total rows calculation using call, ignore paging exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Oct 3, 2019
1 parent b5e7cea commit 87aa2bf
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions php/Job/Space/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ public function run()
}
}

$total = $this->getMapper()->getClient()
->evaluate("return box.space['$this->space'].index[$this->index]:count(...)", $key)[0];
$indexes = $this->getMapper()->getSchema()->getSpace($this->space)->getIndexes();
$indexName = $indexes[$this->index]['name'];

try {
[$total] = $this->getMapper()->getClient()
->call("box.space.$this->space.index.$indexName:count", $key);
} catch (Exception $e) {
// ignore total calculation exception
}

} catch (Exception $e) {
if (!$data) {
Expand Down

0 comments on commit 87aa2bf

Please sign in to comment.