mirror of
https://github.com/tutao/tutanota.git
synced 2025-12-08 06:09:50 +00:00
improve inbox rule handling and run spam prediction after inbox rules
Instead of applying inbox rules based on the unread mail state in the inbox folder, we introduce the new ProcessingState enum on the mail type. If a mail has been processed by the leader client, which is checking for matching inbox rules, the ProcessingState is updated. If there is a matching rule the flag is updated through the MoveMailService, if there is no matching rule, the flag is updated using the ClientClassifierResultService. Both requests are throttled / debounced. After processing inbox rules, spam prediction is conducted for mails that have not yet been moved by an inbox rule. The ProcessingState for not matching ham mails is also updated using the ClientClassifierResultService. This new inbox rule handing solves the following two problems: - when clicking on a notification it could still happen, that sometimes the inbox rules where not applied - when the inbox folder had a lot of unread mails, the loading time did massively increase, since inbox rules were re-applied on every load Co-authored-by: amm <amm@tutao.de> Co-authored-by: Nick <nif@tutao.de> Co-authored-by: das <das@tutao.de> Co-authored-by: abp <abp@tutao.de> Co-authored-by: jhm <17314077+jomapp@users.noreply.github.com> Co-authored-by: map <mpfau@users.noreply.github.com> Co-authored-by: Kinan <104761667+kibibytium@users.noreply.github.com>
This commit is contained in:
parent
030bea4fe6
commit
f11e59672e
53 changed files with 1269 additions and 1010 deletions
|
|
@ -43,6 +43,7 @@ export class EphemeralCacheStorage implements CacheStorage {
|
|||
private readonly blobEntities: Map<string, BlobElementTypeCache> = new Map()
|
||||
private lastUpdateTime: number | null = null
|
||||
private lastTrainedTime: number | null = null
|
||||
private lastTrainedFromScratchTime: number | null = null
|
||||
private userId: Id | null = null
|
||||
private lastBatchIdPerGroup = new Map<Id, Id>()
|
||||
|
||||
|
|
@ -426,6 +427,14 @@ export class EphemeralCacheStorage implements CacheStorage {
|
|||
this.lastTrainedTime = value
|
||||
}
|
||||
|
||||
async getLastTrainedFromScratchTime(): Promise<number> {
|
||||
return this.lastTrainedFromScratchTime ?? Date.now()
|
||||
}
|
||||
|
||||
async setLastTrainedFromScratchTime(ms: number): Promise<void> {
|
||||
this.lastTrainedFromScratchTime = ms
|
||||
}
|
||||
|
||||
async getWholeList<T extends ListElementEntity>(typeRef: TypeRef<T>, listId: Id): Promise<Array<T>> {
|
||||
const parsedInstances = await this.getWholeListParsed(typeRef, listId)
|
||||
return await this.modelMapper.mapToInstances(typeRef, parsedInstances)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue