Improve account subscribe/unsubscribe logging

This commit is contained in:
Michael Vines
2018-10-30 11:47:14 -07:00
committed by Grimes
parent 3a73a09391
commit 8d16f69bb9

View File

@ -139,7 +139,6 @@ impl RpcSolPubSub for RpcSolPubSubImpl {
subscriber: pubsub::Subscriber<Account>, subscriber: pubsub::Subscriber<Account>,
pubkey_str: String, pubkey_str: String,
) { ) {
info!("account_subscribe");
let pubkey_vec = bs58::decode(pubkey_str).into_vec().unwrap(); let pubkey_vec = bs58::decode(pubkey_str).into_vec().unwrap();
if pubkey_vec.len() != mem::size_of::<Pubkey>() { if pubkey_vec.len() != mem::size_of::<Pubkey>() {
subscriber subscriber
@ -154,6 +153,7 @@ impl RpcSolPubSub for RpcSolPubSubImpl {
let id = self.uid.fetch_add(1, atomic::Ordering::SeqCst); let id = self.uid.fetch_add(1, atomic::Ordering::SeqCst);
let sub_id = SubscriptionId::Number(id as u64); let sub_id = SubscriptionId::Number(id as u64);
info!("account_subscribe: account={:?} id={:?}", pubkey, sub_id);
let sink = subscriber.assign_id(sub_id.clone()).unwrap(); let sink = subscriber.assign_id(sub_id.clone()).unwrap();
let bank_sub_id = Keypair::new().pubkey(); let bank_sub_id = Keypair::new().pubkey();
self.account_subscriptions self.account_subscriptions
@ -166,7 +166,7 @@ impl RpcSolPubSub for RpcSolPubSubImpl {
} }
fn account_unsubscribe(&self, id: SubscriptionId) -> Result<bool> { fn account_unsubscribe(&self, id: SubscriptionId) -> Result<bool> {
info!("account_unsubscribe"); info!("account_unsubscribe: id={:?}", id);
if let Some((bank_sub_id, pubkey)) = self.account_subscriptions.write().unwrap().remove(&id) if let Some((bank_sub_id, pubkey)) = self.account_subscriptions.write().unwrap().remove(&id)
{ {
self.bank.remove_account_subscription(&bank_sub_id, &pubkey); self.bank.remove_account_subscription(&bank_sub_id, &pubkey);