diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-27 11:59:08 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2022-04-27 11:59:08 +0300 |
commit | 996eeec16537f7a308706798b4d23bacb8365365 (patch) | |
tree | 83e67d37d3dd61b87f9e5881f14b61d9ebd35f9b /lib/Events | |
parent | ef0c0054dca182f4a0f82514f42a9800035a1dac (diff) |
Build threads conditionallyenhancement/conditional-threading
* If there are new or vanished messages, rebuild all threads
* Skip the process otherwise
This will speed up account and mailbox synchronization in most cases,
especially when the front-end triggers a sync twice a minute.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Events')
-rw-r--r-- | lib/Events/SynchronizationEvent.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Events/SynchronizationEvent.php b/lib/Events/SynchronizationEvent.php index 3af97c70e..6fafe127c 100644 --- a/lib/Events/SynchronizationEvent.php +++ b/lib/Events/SynchronizationEvent.php @@ -37,12 +37,17 @@ class SynchronizationEvent extends Event { /** @var LoggerInterface */ private $logger; + /** @var bool */ + private $rebuildThreads; + public function __construct(Account $account, - LoggerInterface $logger) { + LoggerInterface $logger, + bool $rebuildThreads) { parent::__construct(); $this->account = $account; $this->logger = $logger; + $this->rebuildThreads = $rebuildThreads; } public function getAccount(): Account { @@ -52,4 +57,8 @@ class SynchronizationEvent extends Event { public function getLogger(): LoggerInterface { return $this->logger; } + + public function isRebuildThreads(): bool { + return $this->rebuildThreads; + } } |