generated from Nodarx/template
feat: track cache changes with sequence numbers and tombstones
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -184,7 +184,8 @@ class HarmonizationService
|
||||
|
||||
$flags = MessageProperties::normalizeFlags($flags);
|
||||
if (!self::sameFlags($flags, $cachedFlags[$uid])) {
|
||||
$this->messageStore->updateFlags($serviceId, $mailbox, $uidValidity, $uid, $flags);
|
||||
$seq = $this->mailboxStore->reserveSequence($serviceId, $mailbox);
|
||||
$this->messageStore->updateFlags($serviceId, $mailbox, $uidValidity, $uid, $flags, $seq);
|
||||
$result['updated']++;
|
||||
}
|
||||
unset($cachedFlags[$uid]);
|
||||
@@ -199,10 +200,11 @@ class HarmonizationService
|
||||
array_push($missing, ...array_diff($batch, $ingested));
|
||||
}
|
||||
|
||||
// expunged: cached UIDs the server did not list; meta documents first, then files
|
||||
// expunged: cached UIDs the server did not list; tombstones first, then files
|
||||
$expunged = array_keys($cachedFlags);
|
||||
if ($expunged !== []) {
|
||||
$this->messageStore->delete($serviceId, $mailbox, $uidValidity, ...$expunged);
|
||||
$seq = $this->mailboxStore->reserveSequence($serviceId, $mailbox);
|
||||
$this->messageStore->tombstone($serviceId, $mailbox, $uidValidity, $seq, ...$expunged);
|
||||
$this->fileStore->delete($tenantId, $serviceId, $mailbox, $uidValidity, ...$expunged);
|
||||
$result['removed'] = count($expunged);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user