From f844b092131f8f29297c3c0f7499cea824d515a2 Mon Sep 17 00:00:00 2001 From: projectmoon Date: Sun, 27 Sep 2020 09:22:09 +0000 Subject: [PATCH] Recover from potentially but unlikely poisioned mutexes. --- src/bot.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/bot.rs b/src/bot.rs index b62cc5e..4b3fa41 100644 --- a/src/bot.rs +++ b/src/bot.rs @@ -216,7 +216,11 @@ impl EventEmitter for DiceBot { //Ignore messages that are older than configured duration. if !check_message_age(event, get_oldest_message_age(&self.config)) { - let mut state = self.state.lock().unwrap(); + let mut state = match self.state.lock() { + Ok(state) => state, + Err(poisoned) => poisoned.into_inner(), + }; + (*state).skipped_old_messages(); return; }