Skip to content

Commit 6b6ec2a

Browse files
committed
fix: use the same webxdc ratelimit for all email servers
This removes another distinction between chatmail and non-chatmail and fixes flaky tests/test_webxdc.py::test_webxdc Closes <#7522>
1 parent b1fa105 commit 6b6ec2a

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

src/context.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl Context {
453453
translated_stockstrings: stockstrings,
454454
events,
455455
scheduler: SchedulerState::new(),
456-
ratelimit: RwLock::new(Ratelimit::new(Duration::new(60, 0), 6.0)), // Allow at least 1 message every 10 seconds + a burst of 6.
456+
ratelimit: RwLock::new(Ratelimit::new(Duration::new(3, 0), 3.0)), // Allow at least 1 message every second + a burst of 3.
457457
quota: RwLock::new(None),
458458
new_msgs_notify,
459459
server_id: RwLock::new(None),
@@ -485,12 +485,6 @@ impl Context {
485485
return;
486486
}
487487

488-
if self.is_chatmail().await.unwrap_or_default() {
489-
let mut lock = self.ratelimit.write().await;
490-
// Allow at least 1 message every second + a burst of 3.
491-
*lock = Ratelimit::new(Duration::new(3, 0), 3.0);
492-
}
493-
494488
// The next line is mainly for iOS:
495489
// iOS starts a separate process for receiving notifications and if the user concurrently
496490
// starts the app, the UI process opens the database but waits with calling start_io()

src/webxdc/webxdc_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ async fn test_get_webxdc_info() -> Result<()> {
12891289
let info = instance.get_webxdc_info(&t).await?;
12901290
assert_eq!(info.name, "minimal.xdc");
12911291
assert_eq!(info.icon, WEBXDC_DEFAULT_ICON.to_string());
1292-
assert_eq!(info.send_update_interval, 10000);
1292+
assert_eq!(info.send_update_interval, 1000);
12931293
assert_eq!(info.send_update_max_size, RECOMMENDED_FILE_SIZE as usize);
12941294

12951295
let mut instance = create_webxdc_instance(

0 commit comments

Comments
 (0)