This is an automated email from the ASF dual-hosted git repository.

sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git


The following commit(s) were added to refs/heads/master by this push:
     new 015fc5c  make max_lists configurable
015fc5c is described below

commit 015fc5ca19ec570aeb61c54b92d3324c18a6e791
Author: Sebb <[email protected]>
AuthorDate: Mon Nov 15 22:59:03 2021 +0000

    make max_lists configurable
---
 server/plugins/background.py    | 2 +-
 server/plugins/configuration.py | 2 ++
 server/ponymail.yaml.example    | 1 +
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/server/plugins/background.py b/server/plugins/background.py
index 3971464..de5437f 100644
--- a/server/plugins/background.py
+++ b/server/plugins/background.py
@@ -59,7 +59,7 @@ async def get_lists(database: plugins.configuration.DBConfig) 
-> dict:
     """
     lists = {}
     db = plugins.database.Database(database)
-    limit = 8192
+    limit = database.max_lists
 
     # Fetch aggregations of all public emails
     s = Search(using=db.client, index=database.db_prefix + "-mbox").filter(
diff --git a/server/plugins/configuration.py b/server/plugins/configuration.py
index 7fd47a5..d6c77f6 100644
--- a/server/plugins/configuration.py
+++ b/server/plugins/configuration.py
@@ -80,6 +80,7 @@ class DBConfig:
     url_prefix: str
     db_prefix: str
     max_hits: int
+    max_lists: int
 
     def __init__(self, subyaml: dict):
         self.dburl = str(subyaml.get("dburl", ""))
@@ -89,6 +90,7 @@ class DBConfig:
         self.url_prefix = subyaml.get("url_prefix", "")
         self.db_prefix = str(subyaml.get("db_prefix", "ponymail"))
         self.max_hits = int(subyaml.get("max_hits", 5000))
+        self.max_lists = int(subyaml.get("max_lists", 8192))
 
 
 class Configuration:
diff --git a/server/ponymail.yaml.example b/server/ponymail.yaml.example
index eecdd56..9f994a1 100644
--- a/server/ponymail.yaml.example
+++ b/server/ponymail.yaml.example
@@ -8,6 +8,7 @@ database:
   db_prefix: ponymail                 # DB prefix, usually 'ponymail'
   max_hits: 15000                     # Maximum number of emails to process in 
a search
   pool_size: 15                       # number of connections for async queries
+  max_lists: 8192                     # max number of lists to allow for
 
 tasks:
   refresh_rate:  150                  # Background indexer run interval, in 
seconds

Reply via email to