| 83 | } |
| 84 | |
| 85 | pub async fn normalized_mutlithreaded_util(builder: NormalizedExchangeBuilder, iterations: usize) { |
| 86 | let mut rx = builder |
| 87 | .build_all_multithreaded(1, WsStreamConfig::default().with_max_retries(10), Some(25)) |
| 88 | .unwrap() |
| 89 | .unwrap(); |
| 90 | info!(target: "cex-exchanges::tests::ws", "connected stream"); |
| 91 | |
| 92 | let mut i = 0; |
| 93 | while let Some(val) = rx.next().await { |
| 94 | if val.is_err() { |
| 95 | error!(target: "cex-exchanges::tests::ws", "{:?}", val); |
| 96 | } |
| 97 | |
| 98 | info!(target: "cex-exchanges::tests::ws", "completed {i}/{iterations}"); |
| 99 | |
| 100 | assert!(val.is_ok()); |
| 101 | |
| 102 | let normalized = val.clone().normalize(); |
| 103 | assert_eq!(val, normalized); |
| 104 | |
| 105 | if i == iterations { |
| 106 | break; |
| 107 | } |
| 108 | i += 1; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | pub fn write_json<D>(a: D, path: &str) |
| 113 | where |