From 9480bc0282b80e53795e0f102e164819fc94295b Mon Sep 17 00:00:00 2001 From: dankito Date: Thu, 28 Nov 2024 02:52:29 +0100 Subject: [PATCH] Sped up fetching data --- .../main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt index 01c0a9f..5c526b7 100644 --- a/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt +++ b/e-invoice-domain/src/main/kotlin/net/codinux/invoicing/email/EmailsFetcher.kt @@ -327,6 +327,7 @@ open class EmailsFetcher( } protected open fun mapAccountToJavaMailProperties(account: EmailAccount, options: FetchEmailsOptions) = Properties().apply { + // the documentation of all properties can be found here: https://javaee.github.io/javamail/docs/api/com/sun/mail/imap/package-summary.html put("mail.store.protocol", "imap") put("mail.imap.host", account.serverAddress) @@ -336,6 +337,10 @@ open class EmailsFetcher( val timeout = (options.connectTimeoutSeconds * 1000).toString() put("mail.imap.connectiontimeout", timeout) put("mail.imap.timeout", timeout) + + // speeds up fetching data tremendously + put("mail.imap.fetchsize", "819200") // Partial fetch size in bytes. Defaults to 16K. + put("mail.imap.partialfetch", "false") // Controls whether the IMAP partial-fetch capability should be used. Defaults to true. } } \ No newline at end of file