Merge pull request #606 from llucax/fix-605

Avoid showing "Memories: Indexing process stopped before completion. Will continue on next run" as a warning
pull/653/head
Varun Patil 2023-04-24 13:06:46 -07:00 committed by GitHub
commit 6c28bc054e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class IndexJob extends TimedJob
$this->indexAllUsers();
$this->log('Indexing completed successfully', 'success');
} catch (Service\ProcessClosedException $e) {
$this->log('Indexing process stopped before completion. Will continue on next run', 'warning');
$this->log('Indexing process stopped before completion. Will continue on next run', 'info');
} finally {
\OCA\Memories\Exif::closeStaticExiftoolProc();
}
@ -95,6 +95,11 @@ class IndexJob extends TimedJob
private function log(string $msg, string $type = 'error'): void
{
if ('success' === $type || 'info' === $type) {
// If this is just an informational message, we log it with level info
$this->logger->info('Memories: '.$msg);
}
if ($this->_hasError && 'success' === $type) {
// Don't overwrite an error with a success
return;
@ -103,9 +108,7 @@ class IndexJob extends TimedJob
$this->config->setAppValue(Application::APPNAME, 'last_index_job_status', $msg);
$this->config->setAppValue(Application::APPNAME, 'last_index_job_status_type', $type);
if ('success' === $type) {
// Nothing
} elseif ('warning' === $type) {
if ('warning' === $type) {
$this->logger->warning('Memories: '.$msg);
} elseif ('error' === $type) {
$this->_hasError = true;