aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLymia Aluysia <[email protected]>2018-08-08 07:58:42 -0500
committerAlex M. M <[email protected]>2018-08-08 14:58:42 +0200
commitd1266fc3051a436f87a4778c5081c2228eb50b1c (patch)
tree0117a71ebce91baba0964394c0223a36c9a73f88 /src
parentDecringe an old comment (diff)
downloadserenity-d1266fc3051a436f87a4778c5081c2228eb50b1c.tar.xz
serenity-d1266fc3051a436f87a4778c5081c2228eb50b1c.zip
Fix erroneous deadlock detected messages. (#363)
Diffstat (limited to 'src')
-rw-r--r--src/client/dispatch.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/client/dispatch.rs b/src/client/dispatch.rs
index 7a9e725..3e3bcfa 100644
--- a/src/client/dispatch.rs
+++ b/src/client/dispatch.rs
@@ -30,16 +30,16 @@ macro_rules! update {
{
#[cfg(feature = "cache")]
{
- CACHE.try_write_for(Duration::from_millis(10))
- .and_then(|mut lock| lock.update(&mut $event))
- .or_else(|| {
- warn!(
- "[dispatch] Possible deadlock: couldn't unlock cache to update with event: {:?}",
- $event,
- );
-
- None
- })
+ if let Some(mut lock) = CACHE.try_write_for(Duration::from_millis(10)) {
+ lock.update(&mut $event)
+ } else {
+ warn!(
+ "[dispatch] Possible deadlock: couldn't unlock cache to update with event: {:?}",
+ $event,
+ );
+
+ None
+ }
}
}
};