Client: fix issue when no serum program is registered (#732)

The serum StreamMap exiting aborts the whole streaming job.
This commit is contained in:
Christian Kamm 2023-09-27 12:56:52 +02:00 committed by GitHub
parent ac38ccc687
commit eca4550fa2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -98,6 +98,16 @@ async fn feed_data(
.map_err_anyhow()?,
);
}
// Make sure the serum3_oo_sub_map does not exit when there's no serum_programs
let _unused_serum_sender;
if config.serum_programs.is_empty() {
let (sender, receiver) = jsonrpc_core::futures::channel::mpsc::unbounded();
_unused_serum_sender = sender;
serum3_oo_sub_map.insert(
Pubkey::default(),
jsonrpc_core_client::TypedSubscriptionStream::new(receiver, "foo"),
);
}
let mut slot_sub = client.slots_updates_subscribe().map_err_anyhow()?;