feat: Allow a configurable background sync interval

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2023-06-07 16:33:14 +02:00
Родитель 3e276f54f9
Коммит 89e009ea22
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -42,6 +42,14 @@ Depending on your mail host, it may be necessary to increase your IMAP and/or SM
'app.mail.sieve.timeout' => 2
```
### Background sync interval
Configure how often Mail keeps users' mailboxes updated in the background in seconds. Defaults to 3600.
```php
'app.mail.background-sync-interval' => 7200,
```
### Use php-mail for sending mail
You can use the php-mail function to send mails. This is needed for some webhosters (1&1 (1und1)):
```php

Просмотреть файл

@ -35,9 +35,11 @@ use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJobList;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Throwable;
use function max;
use function sprintf;
class SyncJob extends TimedJob {
@ -54,7 +56,8 @@ class SyncJob extends TimedJob {
MailboxSync $mailboxSync,
ImapToDbSynchronizer $syncService,
LoggerInterface $logger,
IJobList $jobList) {
IJobList $jobList,
IConfig $config) {
parent::__construct($time);
$this->userManager = $userManager;
@ -64,7 +67,12 @@ class SyncJob extends TimedJob {
$this->logger = $logger;
$this->jobList = $jobList;
$this->setInterval(3600);
$this->setInterval(
max(
5 * 60,
$config->getSystemValueInt('app.mail.background-sync-interval', 3600)
),
);
$this->setTimeSensitivity(self::TIME_SENSITIVE);
}