mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 15:15:58 +00:00
Use max-mails
setting with higher priority
The `mail-chunk-size` is set to its configured value or `max-mails` whichever is lower.
This commit is contained in:
parent
c0259dba7e
commit
d9782582d8
@ -106,14 +106,18 @@ docspell.joex {
|
|||||||
max-folders = 50
|
max-folders = 50
|
||||||
|
|
||||||
# How many mails (headers only) to retrieve in one chunk.
|
# How many mails (headers only) to retrieve in one chunk.
|
||||||
mail-chunk-size = 100
|
#
|
||||||
|
# If this is greater than `max-mails' it is set automatically to
|
||||||
|
# the value of `max-mails'.
|
||||||
|
mail-chunk-size = 50
|
||||||
|
|
||||||
# A limit on how many mails to process in one job run. This is
|
# A limit on how many mails to process in one job run. This is
|
||||||
# only to avoid resource allocation to one user/collective.
|
# meant to avoid too heavy resource allocation to one
|
||||||
|
# user/collective.
|
||||||
#
|
#
|
||||||
# If more than this number of mails is encountered, a warning is
|
# If more than this number of mails is encountered, a warning is
|
||||||
# logged.
|
# logged.
|
||||||
max-mails = 1000
|
max-mails = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ case class Config(
|
|||||||
object Config {
|
object Config {
|
||||||
case class Bind(address: String, port: Int)
|
case class Bind(address: String, port: Int)
|
||||||
|
|
||||||
case class ScanMailbox(maxFolders: Int, mailChunkSize: Int, maxMails: Int)
|
case class ScanMailbox(maxFolders: Int, mailChunkSize: Int, maxMails: Int) {
|
||||||
|
def mailBatchSize: Int =
|
||||||
|
math.min(mailChunkSize, maxMails)
|
||||||
|
}
|
||||||
case class UserTasks(scanMailbox: ScanMailbox)
|
case class UserTasks(scanMailbox: ScanMailbox)
|
||||||
}
|
}
|
||||||
|
@ -164,11 +164,11 @@ object ScanMailboxTask {
|
|||||||
for {
|
for {
|
||||||
_ <- Kleisli.liftF(
|
_ <- Kleisli.liftF(
|
||||||
ctx.logger.debug(
|
ctx.logger.debug(
|
||||||
s"Searching next ${cfg.mailChunkSize} mails in ${folder.name}."
|
s"Searching next ${cfg.mailBatchSize} mails in ${folder.name}."
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
query <- Kleisli.liftF(q)
|
query <- Kleisli.liftF(q)
|
||||||
mails <- a.search(folder, cfg.mailChunkSize)(query)
|
mails <- a.search(folder, cfg.mailBatchSize)(query)
|
||||||
_ <- Kleisli.liftF(
|
_ <- Kleisli.liftF(
|
||||||
ctx.logger.debug(
|
ctx.logger.debug(
|
||||||
s"Found ${mails.count} mails in folder. Reading first ${mails.mails.size}"
|
s"Found ${mails.count} mails in folder. Reading first ${mails.mails.size}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user