From e5ce0bdeb778f023978d97c9aec24b0f198960eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Hru=C5=A1ka?= Date: Sat, 18 Sep 2021 20:50:14 +0200 Subject: [PATCH] sleep after posting --- .gitignore | 1 + src/command.rs | 2 ++ src/group_handler/handle_mention.rs | 2 ++ src/group_handler/mod.rs | 8 -------- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 1758c24..feee3e1 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ group-actor-data.toml groups.json fedigroups *.bak +groups.d/ \ No newline at end of file diff --git a/src/command.rs b/src/command.rs index 7612e3e..ad8717c 100644 --- a/src/command.rs +++ b/src/command.rs @@ -556,7 +556,9 @@ mod test { assert!(RE_A_HASHTAG.is_match("#banana")); assert!(RE_A_HASHTAG.is_match("#ласточка")); assert!(RE_A_HASHTAG.is_match("#χαλβάς")); + assert!(RE_A_HASHTAG.is_match("#городДляЛюдей")); assert!(RE_A_HASHTAG.is_match("foo #banana gfdfgd")); + assert!(RE_A_HASHTAG.is_match("foo #городДляЛюдей aaa")); for (i, c) in RE_A_HASHTAG.captures_iter("foo #banana #χαλβάς #ласточка").enumerate() { if i == 0 { diff --git a/src/group_handler/handle_mention.rs b/src/group_handler/handle_mention.rs index d45c446..2892678 100644 --- a/src/group_handler/handle_mention.rs +++ b/src/group_handler/handle_mention.rs @@ -274,6 +274,8 @@ impl<'a> ProcessMention<'a> { { let _ = self.client.new_status(post) .await.log_error("Failed to post"); + // Sleep a bit to avoid throttling + tokio::time::sleep(Duration::from_secs(1)).await; } } diff --git a/src/group_handler/mod.rs b/src/group_handler/mod.rs index db000b3..ded429e 100644 --- a/src/group_handler/mod.rs +++ b/src/group_handler/mod.rs @@ -297,16 +297,8 @@ impl GroupHandle { } NotificationType::Follow => { grp_info!(self, "New follower!"); - // Just greet the user always self.handle_new_follow(¬if_acct, notif_user_id).await; - - // if self.config.is_member_or_admin(¬if_acct) { - // // Already joined, just doing something silly, ignore this - // grp_debug!(self, "User already a member, ignoring"); - // } else { - // - // } } NotificationType::Favourite => {} NotificationType::Reblog => {}