diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2019-09-21 18:20:15 +0300 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2019-09-21 18:20:15 +0300 |
commit | aedb903ca6a45ef65f2f1842dcb3e011cfe82e73 (patch) | |
tree | afbcae10c357edbea380523a8e390bbddf4a733c | |
parent | 99614aea14e3b83fe6170b2c510b4aacff51bd32 (diff) |
TICK_TTL as settings
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
-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..ea6c21e 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 = $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 { |