You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/10/17 20:40:25 UTC
[incubator-ponymail-foal] 02/02: make constant
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 356d1d320a245293d269935b6fbfc3eafc18f004
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 17 22:40:14 2021 +0200
make constant
---
tools/migrate.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/migrate.py b/tools/migrate.py
index e288330..8c431c3 100644
--- a/tools/migrate.py
+++ b/tools/migrate.py
@@ -40,6 +40,9 @@ import sys
# Increment this number whenever breaking changes happen in the migration workflow:
MIGRATION_MAGIC_NUMBER = "2"
+# Standard "short body" max length for email aggregations
+SHORT_BODY_MAX_LEN = 200
+
# Max number of parallel conversions to perform before pushing. 75-ish percent of max cores.
cores = len(os.sched_getaffinity(0))
MAX_PARALLEL_OPS = max(min(int((cores + 1) * 0.75), cores - 1), 1)
@@ -199,7 +202,7 @@ def process_document(old_es, doc, old_dbname, dbname_source, dbname_mbox, do_dki
doc["_source"]["dbid"] = hashlib.sha3_256(source_text).hexdigest()
# Add in shortened body for search aggs
- doc["_source"]["body_short"] = doc["_source"]["body"][:210]
+ doc["_source"]["body_short"] = doc["_source"]["body"][:SHORT_BODY_MAX_LEN+10]
# Add in gravatar
header_from = doc["_source"]["from"]