mirror of
https://github.com/tutao/tutanota.git
synced 2025-10-19 07:53:47 +00:00
add prefetching to missed entityUpdates, instance/patch on EntityUpdate
When processing the missed entityUpdates in EventQueue in EventBusClient , we group entityUpdates based on typeRefs and listIds and do loadMultiple requests instead of loading them one-by-one (prefetching). Additionally, when the client is online, the server enriches the WebSocket message with either the instance (in case of a CREATE event), or with the patches list (in case of an UPDATE event) so that we do not need to do an additional GET request and can either put the instance into the cache or update the entry on the cache using the PatchMerger instead. Co-authored-by: abp <abp@tutao.de> Co-authored-by: das <das@tutao.de> Co-authored-by: jomapp <17314077+jomapp@users.noreply.github.com> Co-authored-by: Kinan <104761667+kibibytium@users.noreply.github.com> Co-authored-by: map <mpfau@users.noreply.github.com> Co-authored-by: sug <sug@tutao.de>
This commit is contained in:
parent
681b22cb4f
commit
4db7e9b1e9
63 changed files with 4193 additions and 2291 deletions
|
@ -11,8 +11,7 @@ import { instance, matchers, object, when } from "testdouble"
|
|||
import { UserController } from "../../../src/common/api/main/UserController.js"
|
||||
import { createTestEntity } from "../TestUtils.js"
|
||||
import { EntityUpdateData } from "../../../src/common/api/common/utils/EntityUpdateUtils.js"
|
||||
import { MailboxDetail, MailboxModel } from "../../../src/common/mailFunctionality/MailboxModel.js"
|
||||
import { InboxRuleHandler } from "../../../src/mail-app/mail/model/InboxRuleHandler.js"
|
||||
import { MailboxModel } from "../../../src/common/mailFunctionality/MailboxModel.js"
|
||||
import { getElementId, getListId } from "../../../src/common/api/common/utils/EntityUtils.js"
|
||||
import { MailModel } from "../../../src/mail-app/mail/model/MailModel.js"
|
||||
import { EventController } from "../../../src/common/api/main/EventController.js"
|
||||
|
@ -27,9 +26,7 @@ o.spec("MailModelTest", function () {
|
|||
inboxFolder.folderType = MailSetKind.INBOX
|
||||
const anotherFolder = createTestEntity(MailFolderTypeRef, { _id: ["folderListId", "archiveId"] })
|
||||
anotherFolder.folderType = MailSetKind.ARCHIVE
|
||||
let mailboxDetails: Partial<MailboxDetail>[]
|
||||
let logins: LoginController
|
||||
let inboxRuleHandler: InboxRuleHandler
|
||||
let mailFacade: MailFacade
|
||||
const restClient: EntityRestClientMock = new EntityRestClientMock()
|
||||
|
||||
|
@ -44,7 +41,6 @@ o.spec("MailModelTest", function () {
|
|||
when(userController.isUpdateForLoggedInUserInstance(matchers.anything(), matchers.anything())).thenReturn(false)
|
||||
when(logins.getUserController()).thenReturn(userController)
|
||||
|
||||
inboxRuleHandler = object()
|
||||
model = new MailModel(
|
||||
downcast({}),
|
||||
mailboxModel,
|
||||
|
@ -55,8 +51,6 @@ o.spec("MailModelTest", function () {
|
|||
null,
|
||||
() => null,
|
||||
)
|
||||
// not pretty, but works
|
||||
// model.mailboxDetails(mailboxDetails as MailboxDetail[])
|
||||
})
|
||||
o("doesn't send notification for another folder", async function () {
|
||||
const mailSetEntry = createTestEntity(MailSetEntryTypeRef, { _id: [anotherFolder.entries, "mailSetEntryId"] })
|
||||
|
@ -102,6 +96,9 @@ o.spec("MailModelTest", function () {
|
|||
operation,
|
||||
instanceListId,
|
||||
instanceId,
|
||||
instance: null,
|
||||
patches: null,
|
||||
isPrefetched: false,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue