diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-09-23 13:35:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-23 13:35:50 +0300 |
commit | 18655e3dc3856e8ecd9da42e520993fcbb4bd1c1 (patch) | |
tree | 9b7be86c4b436a20df7788f6bcf1dac2888e67b6 | |
parent | 99614aea14e3b83fe6170b2c510b4aacff51bd32 (diff) | |
parent | 5f298928a950e1fe23847dbc7db15a0b2a711bcd (diff) |
Merge pull request #542 from nextcloud/feature/noid/tick-ttl-as-settings
TICK_TTL as settings
-rw-r--r-- | lib/Model/Runner.php | 2 | ||||
-rw-r--r-- | lib/Service/ConfigService.php | 5 | ||||
-rw-r--r-- | lib/Service/RunningService.php | 4 |
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/Model/Runner.php b/lib/Model/Runner.php index 7f17b7f..19f4eb1 100644 --- a/lib/Model/Runner.php +++ b/lib/Model/Runner.php @@ -53,8 +53,6 @@ class Runner implements IRunner { use TArrayTools; - const TICK_TTL = 1800; - const TICK_MINIMUM = 2; const TICK_UPDATE = 10; const MEMORY_UPDATE = 5; diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index 00ccbd0..a799f31 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -50,14 +50,15 @@ class ConfigService { const SEARCH_PLATFORM = 'search_platform'; const PROVIDER_INDEXED = 'provider_indexed'; const CRON_LAST_ERR_RESET = 'cron_err_reset'; - + const TICK_TTL = 'tick_ttl'; /** @var array */ public $defaults = [ self::SEARCH_PLATFORM => '', self::APP_NAVIGATION => '0', self::PROVIDER_INDEXED => '', - self::CRON_LAST_ERR_RESET => '0' + self::CRON_LAST_ERR_RESET => '0', + self::TICK_TTL => '1800' ]; diff --git a/lib/Service/RunningService.php b/lib/Service/RunningService.php index a182f0b..1cfc1f8 100644 --- a/lib/Service/RunningService.php +++ b/lib/Service/RunningService.php @@ -36,7 +36,6 @@ use OCA\FullTextSearch\Exceptions\RunnerAlreadyUpException; use OCA\FullTextSearch\Exceptions\TickDoesNotExistException; use OCA\FullTextSearch\Exceptions\TickIsNotAliveException; use OCA\FullTextSearch\Model\Tick; -use OCA\FullTextSearch\Model\Runner; /** @@ -200,11 +199,12 @@ class RunningService { * @return bool */ public function isAlreadyRunning(): bool { + $ttl = (int) $this->configService->getAppValue(ConfigService::TICK_TTL); $ticks = $this->tickRequest->getTicksByStatus('run'); $isAlreadyRunning = false; foreach ($ticks as $tick) { - if ($tick->getTick() < (time() - Runner::TICK_TTL)) { + if ($tick->getTick() < (time() - $ttl)) { $tick->setStatus('timeout'); $this->tickRequest->update($tick); } else { |