From 28952789a4c9228d0ef47131bfca6e19dddae56b Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Mon, 6 Nov 2023 18:07:02 +0100 Subject: [PATCH] fix: raise lower auto-download limit to 160k --- python/tests/test_1_online.py | 4 ++-- src/download.rs | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/python/tests/test_1_online.py b/python/tests/test_1_online.py index ac227da1ed..f30ed4e037 100644 --- a/python/tests/test_1_online.py +++ b/python/tests/test_1_online.py @@ -367,7 +367,7 @@ def test_webxdc_download_on_demand(acfactory, data, lp): lp.sec("ac2 sets download limit") ac2.set_config("download_limit", "100") - assert msg1.send_status_update({"payload": base64.b64encode(os.urandom(50000))}, "some test data") + assert msg1.send_status_update({"payload": base64.b64encode(os.urandom(300000))}, "some test data") ac2_update = ac2._evtracker.wait_next_incoming_message() assert ac2_update.download_state == dc.const.DC_DOWNLOAD_AVAILABLE assert not msg2.get_status_updates() @@ -1445,7 +1445,7 @@ def test_reaction_to_partially_fetched_msg(acfactory, lp, tmp_path): message, then processes a partially downloaded message. - As a result, Bob does not see a reaction """ - download_limit = 32768 + download_limit = 300000 ac1, ac2 = acfactory.get_online_accounts(2) ac1_addr = ac1.get_config("addr") chat = ac1.create_chat(ac2) diff --git a/src/download.rs b/src/download.rs index 292ebd4b36..09ab716c81 100644 --- a/src/download.rs +++ b/src/download.rs @@ -18,12 +18,11 @@ use crate::{stock_str, EventType}; /// Download limits should not be used below `MIN_DOWNLOAD_LIMIT`. /// -/// Some messages as non-delivery-reports (NDN) or read-receipts (MDN) -/// need to be downloaded completely to handle them correctly, -/// eg. to assign them to the correct chat. -/// As these messages are typically small, -/// they're caught by `MIN_DOWNLOAD_LIMIT`. -pub(crate) const MIN_DOWNLOAD_LIMIT: u32 = 32768; +/// For better UX, some messages as add-member, non-delivery-reports (NDN) or read-receipts (MDN) +/// should always be downloaded completely to handle them correctly, +/// also in larger groups and if group and contact avatar are attached. +/// Most of these cases are caught by `MIN_DOWNLOAD_LIMIT`. +pub(crate) const MIN_DOWNLOAD_LIMIT: u32 = 163840; /// If a message is downloaded only partially /// and `delete_server_after` is set to small timeouts (eg. "at once"),