aboutsummaryrefslogtreecommitdiff
path: root/src/cache
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2017-08-11 12:10:41 +0200
committeracdenisSK <[email protected]>2017-08-11 12:10:41 +0200
commit7e8da0c6574ed051de5a9d51001ead0779dfb1de (patch)
treec2a15757b3934f38030d1f0b972a53cc0effaa8e /src/cache
parentPut `update_user_entry` back into the cache (diff)
downloadserenity-7e8da0c6574ed051de5a9d51001ead0779dfb1de.tar.xz
serenity-7e8da0c6574ed051de5a9d51001ead0779dfb1de.zip
Don't do any other fuzz about private channels if they're already in the cache
Diffstat (limited to 'src/cache')
-rw-r--r--src/cache/cache_events_impl.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cache/cache_events_impl.rs b/src/cache/cache_events_impl.rs
index 0ac1f8f..8146e73 100644
--- a/src/cache/cache_events_impl.rs
+++ b/src/cache/cache_events_impl.rs
@@ -113,6 +113,10 @@ impl CacheEventsImpl for super::Cache {
.map(Channel::Guild)
},
Channel::Private(ref channel) => {
+ if let Some(ref channel) = self.private_channels.get(&channel.read().unwrap().id) {
+ return Some(Channel::Private((*channel).clone()));
+ }
+
let channel = channel.clone();
let mut channel_writer = channel.write().unwrap();