diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-10-19 14:43:51 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2018-10-19 14:43:51 +0300 |
commit | 9c650034f00f95e2480f430ab1866e49331bcbc8 (patch) | |
tree | 72e76e4411fdabd73528b91bedebbb4f8657a172 | |
parent | 70e253a6c79b86612a4f6646f75b2aea8950849f (diff) | |
parent | f71f193e07e387e3cb4326a8655d83bb900fc7c5 (diff) |
Merge branch 'stable14'
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-rw-r--r-- | CHANGELOG.md | 11 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | appinfo/info.xml | 4 | ||||
-rw-r--r-- | lib/Model/Runner.php | 54 |
4 files changed, 51 insertions, 20 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index e1bd640..39ef361 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,17 @@ # Changelog +### 1.0.2 + +- improvement: long process while indexing should not timeout (Force Quit). +- misc: removing compat with NC12. + + +### 1.0.1 + +improvement: some rework on the process wrapper. + + ### 1.0.0 First stable release @@ -9,7 +9,7 @@ package_name=$(app_name) cert_dir=$(HOME)/.nextcloud/certificates github_account=nextcloud codecov_token_dir=$(HOME)/.nextcloud/codecov_token -version+=1.0.1 +version+=1.0.2 all: appstore diff --git a/appinfo/info.xml b/appinfo/info.xml index e60c04e..7b4be3e 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -10,7 +10,7 @@ Core App of the full-text search framework for your Nextcloud. ]]> </description> - <version>1.0.1</version> + <version>1.0.2</version> <licence>agpl</licence> <author>Maxence Lange</author> <namespace>FullTextSearch</namespace> @@ -23,7 +23,7 @@ Core App of the full-text search framework for your Nextcloud. <repository>https://github.com/nextcloud/fulltextsearch.git</repository> <screenshot>https://raw.githubusercontent.com/nextcloud/fulltextsearch/master/screenshots/0.3.0.png</screenshot> <dependencies> - <nextcloud min-version="12" max-version="14"/> + <nextcloud min-version="13" max-version="14"/> </dependencies> <background-jobs> diff --git a/lib/Model/Runner.php b/lib/Model/Runner.php index 8644dd9..a2187aa 100644 --- a/lib/Model/Runner.php +++ b/lib/Model/Runner.php @@ -37,10 +37,11 @@ use Symfony\Component\Console\Output\OutputInterface; class Runner { + const TICK_TTL = 1800; - const TICK_TTL = 300; const TICK_MINIMUM = 2; - const MEMORY_INFO_UPDATE = 5; + const TICK_UPDATE = 10; + const MEMORY_UPDATE = 5; const RESULT_TYPE_SUCCESS = 1; const RESULT_TYPE_WARNING = 4; @@ -74,7 +75,10 @@ class Runner { private $oldAction = ''; /** @var int */ - private $ramTick = 0; + private $ramUpdate = 0; + + /** @var int */ + private $tickUpdate = 0; /** @var array */ private $methodOnKeyPress = []; @@ -175,14 +179,10 @@ class Runner { } $this->setInfo('action', $action); - try { - $this->runningService->update($this->tickId, $action); - } catch (TickIsNotAliveException $e) { - $this->output('Force Quit'); - exit(); - } - $this->updateTick($tick); + $this->updateTick($tick, $action); + $this->updateRamInfo($tick); + $this->oldAction = $action; $this->oldTick = $tick; @@ -290,9 +290,7 @@ class Runner { $this->methodOnInfoUpdate[] = $method; } - /** - * @param $key - */ + public function infoUpdated() { foreach ($this->methodOnInfoUpdate as $method) { call_user_func($method, $this->info); @@ -367,15 +365,37 @@ class Runner { /** + * @param int $tick + * @param string $action + * + * @throws TickDoesNotExistException + */ + private function updateTick($tick, $action) { + if ($this->oldAction === $action && ($this->tickUpdate + self::TICK_UPDATE > $tick)) { + return; + } + + try { + $this->runningService->update($this->tickId, $action); + } catch (TickIsNotAliveException $e) { + $this->output('Force Quit'); + exit(); + } + + $this->tickUpdate = $tick; + } + + + /** * @param $tick */ - private function updateTick($tick) { - if (($this->ramTick + self::MEMORY_INFO_UPDATE) > $tick) { + private function updateRamInfo($tick) { + if (($this->ramUpdate + self::MEMORY_UPDATE) > $tick) { return; } $this->setInfo('_memory', round((memory_get_usage() / 1024 / 1024)) . ' MB'); - $this->ramTick = $tick; + $this->ramUpdate = $tick; } @@ -461,4 +481,4 @@ class Runner { } -}
\ No newline at end of file +} |