feat: Allow a configurable background sync interval
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Родитель
3e276f54f9
Коммит
89e009ea22
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче