Skip to content

Instantly share code, notes, and snippets.

@daboross
Created May 21, 2017 09:34
Show Gist options
  • Save daboross/2a1ab943a16169a31987360d2731f797 to your computer and use it in GitHub Desktop.
Save daboross/2a1ab943a16169a31987360d2731f797 to your computer and use it in GitHub Desktop.
messages_future.map(move |redis_msg| {
let lock = refs.lock();
let res: u32 = lock.map(|subscriptions| {
subscriptions.get(&channel)
.map(|subscription| {
subscription.iter()
.cloned()
.map(|subscription_id| {
if redis_msg.channel_name == channel {
println!("subscription_id in map and msg {:?}", subscription_id);
println!("msg: {:?}", redis_msg);
active_subscriptions.get(&subscription_id)
.map(|on_message_closure| on_message_closure(&redis_msg.payload));
};
subscription_id
})
.collect::<Vec<u32>>()
})
// Ok(subscriptions)
})
.unwrap()
.unwrap()
.first()
.map(|x| *x)
.unwrap();
res
})
.boxed()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment