Ver código fonte

Debug issue with notifications

Added more logs
Cesar Rodas 2 meses atrás
pai
commit
a654eebcc5
2 arquivos alterados com 24 adições e 7 exclusões
  1. 23 7
      crates/cdk/src/pub_sub.rs
  2. 1 0
      misc/mintd_payment_processor.sh

+ 23 - 7
crates/cdk/src/pub_sub.rs

@@ -39,7 +39,7 @@ pub const DEFAULT_CHANNEL_SIZE: usize = 10;
 /// type
 pub struct Manager<T, I, F>
 where
-    T: Indexable<Type = I> + Clone + Send + Sync + 'static,
+    T: Indexable<Type = I> + Debug + Clone + Send + Sync + 'static,
     I: PartialOrd + Clone + Debug + Ord + Send + Sync + 'static,
     F: OnNewSubscription<Index = I, Event = T> + Send + Sync + 'static,
 {
@@ -52,7 +52,7 @@ where
 
 impl<T, I, F> Default for Manager<T, I, F>
 where
-    T: Indexable<Type = I> + Clone + Send + Sync + 'static,
+    T: Indexable<Type = I> + Debug + Clone + Send + Sync + 'static,
     I: PartialOrd + Clone + Debug + Ord + Send + Sync + 'static,
     F: OnNewSubscription<Index = I, Event = T> + Send + Sync + 'static,
 {
@@ -77,7 +77,7 @@ where
 
 impl<T, I, F> From<F> for Manager<T, I, F>
 where
-    T: Indexable<Type = I> + Clone + Send + Sync + 'static,
+    T: Indexable<Type = I> + Debug + Clone + Send + Sync + 'static,
     I: PartialOrd + Clone + Debug + Ord + Send + Sync + 'static,
     F: OnNewSubscription<Index = I, Event = T> + Send + Sync + 'static,
 {
@@ -90,7 +90,7 @@ where
 
 impl<T, I, F> Manager<T, I, F>
 where
-    T: Indexable<Type = I> + Clone + Send + Sync + 'static,
+    T: Indexable<Type = I> + Debug + Clone + Send + Sync + 'static,
     I: PartialOrd + Clone + Debug + Ord + Send + Sync + 'static,
     F: OnNewSubscription<Index = I, Event = T> + Send + Sync + 'static,
 {
@@ -112,7 +112,15 @@ where
                     continue;
                 }
                 sent.insert(sub_id);
-                let _ = sender.try_send((key.into(), event.clone()));
+                let _ = sender
+                    .try_send((key.into(), event.clone()))
+                    .inspect_err(|err| {
+                        tracing::info!(
+                            "Failed to send notification {:?} with error {:?}",
+                            event,
+                            err
+                        );
+                    });
             }
         }
     }
@@ -168,7 +176,15 @@ where
                 {
                     Ok(events) => {
                         for event in events {
-                            let _ = sender.try_send((sub_id_for_worker.clone(), event));
+                            let _ = sender
+                                .try_send((sub_id_for_worker.clone(), event.clone()))
+                                .inspect_err(|err| {
+                                    tracing::info!(
+                                        "Failed to send on_new_subscription notification {:?} with error {:?}",
+                                        event,
+                                        err
+                                    );
+                                });
                         }
                     }
                     Err(err) => {
@@ -243,7 +259,7 @@ where
 /// Manager goes out of scope, stop all background tasks
 impl<T, I, F> Drop for Manager<T, I, F>
 where
-    T: Indexable<Type = I> + Clone + Send + Sync + 'static,
+    T: Indexable<Type = I> + Debug + Clone + Send + Sync + 'static,
     I: Clone + Debug + PartialOrd + Ord + Send + Sync + 'static,
     F: OnNewSubscription<Index = I, Event = T> + Send + Sync + 'static,
 {

+ 1 - 0
misc/mintd_payment_processor.sh

@@ -137,6 +137,7 @@ export CDK_MINTD_LISTEN_PORT=$CDK_ITESTS_MINT_PORT_0;
 export CDK_MINTD_LN_BACKEND="grpcprocessor";
 export CDK_MINTD_GRPC_PAYMENT_PROCESSOR_ADDRESS="http://127.0.0.1";
 export CDK_MINTD_GRPC_PAYMENT_PROCESSOR_PORT="8090";
+export CDK_MINTD_LOGGING_CONSOLE_LEVEL="debug"
 export CDK_MINTD_GRPC_PAYMENT_PROCESSOR_SUPPORTED_UNITS="sat";
 export CDK_MINTD_MNEMONIC="eye survey guilt napkin crystal cup whisper salt luggage manage unveil loyal";