mirror of
https://github.com/tutao/tutanota.git
synced 2025-10-19 07:53:47 +00:00
fix tests part 3
This commit is contained in:
parent
9cbeba2b39
commit
632eabe1b7
2 changed files with 26 additions and 21 deletions
|
@ -37,27 +37,33 @@ export class SpamClassificationHandler {
|
||||||
sendMoveMailServiceRequest = debounce(DEBOUNCE_MOVE_MAIL_SERVICE_REQUESTS_MS, async (mailFacade: MailFacade) => {
|
sendMoveMailServiceRequest = debounce(DEBOUNCE_MOVE_MAIL_SERVICE_REQUESTS_MS, async (mailFacade: MailFacade) => {
|
||||||
// Each update to MoveMailService (for ham or spam mails that did move) requires one request
|
// Each update to MoveMailService (for ham or spam mails that did move) requires one request
|
||||||
// We debounce the requests to a rate of DEBOUNCE_MOVE_MAIL_SERVICE_REQUESTS_MS
|
// We debounce the requests to a rate of DEBOUNCE_MOVE_MAIL_SERVICE_REQUESTS_MS
|
||||||
await this.sendMoveMailRequest(mailFacade, this.hamMoveMailData)
|
if (this.hamMoveMailData) {
|
||||||
await this.sendMoveMailRequest(mailFacade, this.spamMoveMailData)
|
const moveMailData = this.hamMoveMailData
|
||||||
|
this.hamMoveMailData = null
|
||||||
|
await this.sendMoveMailRequest(mailFacade, moveMailData)
|
||||||
|
}
|
||||||
|
if (this.spamMoveMailData) {
|
||||||
|
const moveMailData = this.spamMoveMailData
|
||||||
|
this.spamMoveMailData = null
|
||||||
|
await this.sendMoveMailRequest(mailFacade, moveMailData)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
async sendMoveMailRequest(mailFacade: MailFacade, moveMailData: MoveMailData | null): Promise<void> {
|
async sendMoveMailRequest(mailFacade: MailFacade, moveMailData: MoveMailData): Promise<void> {
|
||||||
if (moveMailData) {
|
mailFacade
|
||||||
mailFacade
|
.moveMails(moveMailData.mails, moveMailData.targetFolder, null, ClientClassifierType.CLIENT_CLASSIFICATION)
|
||||||
.moveMails(moveMailData.mails, moveMailData.targetFolder, null, ClientClassifierType.CLIENT_CLASSIFICATION)
|
.catch(
|
||||||
.catch(
|
ofClass(LockedError, (e) => {
|
||||||
ofClass(LockedError, (e) => {
|
// LockedError should no longer be thrown!?!
|
||||||
// LockedError should no longer be thrown!?!
|
console.log("moving mails failed", e, moveMailData.targetFolder)
|
||||||
console.log("moving mails failed", e, moveMailData.targetFolder)
|
}),
|
||||||
}),
|
)
|
||||||
)
|
.catch(
|
||||||
.catch(
|
ofClass(PreconditionFailedError, (e) => {
|
||||||
ofClass(PreconditionFailedError, (e) => {
|
// move mail operation may have been locked by other process
|
||||||
// move mail operation may have been locked by other process
|
console.log("moving mails failed", e, moveMailData.targetFolder)
|
||||||
console.log("moving mails failed", e, moveMailData.targetFolder)
|
}),
|
||||||
}),
|
)
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async predictSpamForNewMail(mail: Mail, mailDetails: MailDetails, sourceFolder: MailFolder, folderSystem: FolderSystem): Promise<MailFolder> {
|
public async predictSpamForNewMail(mail: Mail, mailDetails: MailDetails, sourceFolder: MailFolder, folderSystem: FolderSystem): Promise<MailFolder> {
|
||||||
|
|
|
@ -38,7 +38,6 @@ import type { Tensor } from "@tensorflow/tfjs-core"
|
||||||
import type { ModelArtifacts } from "@tensorflow/tfjs-core/dist/io/types"
|
import type { ModelArtifacts } from "@tensorflow/tfjs-core/dist/io/types"
|
||||||
import type { ModelFitArgs } from "@tensorflow/tfjs-layers"
|
import type { ModelFitArgs } from "@tensorflow/tfjs-layers"
|
||||||
import { OfflineStoragePersistence } from "../index/OfflineStoragePersistence"
|
import { OfflineStoragePersistence } from "../index/OfflineStoragePersistence"
|
||||||
import { Mail } from "../../../common/api/entities/tutanota/TypeRefs"
|
|
||||||
|
|
||||||
assertWorkerOrNode()
|
assertWorkerOrNode()
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ export type SpamPredMailDatum = {
|
||||||
ownerGroup: Id
|
ownerGroup: Id
|
||||||
}
|
}
|
||||||
|
|
||||||
const PREDICTION_THRESHOLD = 0.5
|
const PREDICTION_THRESHOLD = 0.55
|
||||||
|
|
||||||
export type PreprocessConfiguration = {
|
export type PreprocessConfiguration = {
|
||||||
isPreprocessMails: boolean
|
isPreprocessMails: boolean
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue