offlineimap3 icon indicating copy to clipboard operation
offlineimap3 copied to clipboard

Document reasoning for having maxsyncaccounts

Open xaverdh opened this issue 1 year ago • 1 comments

What is the reasoning for having maxsyncaccounts and why is it encouraged to not use this? for security reasons?

xaverdh avatar Feb 19 '24 12:02 xaverdh

Hi @xaverdh

It is related to the number of threads used. See this code in offlineimap/threadutil.py, line 183:

def initInstanceLimit(limitNamespace, instancemax):
    """Initialize the instance-limited thread implementation.

    Run up to intancemax threads for the given limitNamespace. This allows to
    honor maxsyncaccounts and maxconnections."""

    global limitedNamespaces

    if limitNamespace not in limitedNamespaces:
        limitedNamespaces[limitNamespace] = BoundedSemaphore(instancemax)
The value of `instancemax` is the value of `maxsyncaccounts`, see `init.py`, line 362:

        threadutil.initInstanceLimit(
            ACCOUNT_LIMITED_THREAD_NAME,
            config.getdefaultint('general', 'maxsyncaccounts', 1)
        )

I hope this helps. If the answer is ok for you, please, close the issue. If you need more info, do not hesitate to ask.

Best regards, kix.

thekix avatar Aug 17 '24 19:08 thekix