Merge pull request #4588 from nymtech/jon/explicitly-handle-sqlite-constraint-violation

Explicitly handle constraint unique violation when importing credential
This commit is contained in:
Tommy Verrall
2024-05-13 09:57:42 +01:00
committed by Jędrzej Stuczyński
19 changed files with 1597 additions and 3412 deletions
+14 -6
View File
@@ -4,7 +4,7 @@
use crate::config::Config;
use crate::error::MixnodeError;
use crate::node::node_description::NodeDescription;
use log::info;
use log::{error, info};
use nym_bin_common::bin_info_owned;
use nym_crypto::asymmetric::{encryption, identity};
use nym_node_http_api::api::api_requests;
@@ -104,11 +104,19 @@ impl<'a> HttpApiBuilder<'a> {
.with_landing_page_assets(self.mixnode_config.http.landing_page_assets_path.as_ref());
let router = nym_node_http_api::NymNodeRouter::new(config, None, None);
let server = router
// .with_merged(legacy::routes(self.legacy_mixnode, self.legacy_descriptor))
.build_server(&bind_address)?
.with_task_client(task_client);
tokio::spawn(async move { server.run().await });
tokio::spawn(async move {
let server = match router.build_server(&bind_address).await {
Ok(server) => server.with_task_client(task_client),
Err(err) => {
error!("failed to create http server: {err}");
// this will cause global shutdown
drop(task_client);
return;
}
};
server.run().await
});
Ok(())
}
}