mirror of
https://github.com/Syfaro/bkapi.git
synced 2024-11-21 22:43:24 +00:00
Use Postgres if database subscribe specified.
This commit is contained in:
parent
e2266a6a7d
commit
76504cdc28
@ -110,15 +110,7 @@ async fn main() {
|
|||||||
|
|
||||||
let tree_clone = tree.clone();
|
let tree_clone = tree.clone();
|
||||||
let config_clone = config.clone();
|
let config_clone = config.clone();
|
||||||
if let Some(client) = client.clone() {
|
if let Some(subscription) = config.database_subscribe.clone() {
|
||||||
tracing::info!("starting to listen for payloads from nats");
|
|
||||||
|
|
||||||
tokio::task::spawn(async {
|
|
||||||
tree::listen_for_payloads_nats(config_clone, pool, client, tree_clone, sender)
|
|
||||||
.await
|
|
||||||
.unwrap_or_log();
|
|
||||||
});
|
|
||||||
} else if let Some(subscription) = config.database_subscribe.clone() {
|
|
||||||
tracing::info!("starting to listen for payloads from postgres");
|
tracing::info!("starting to listen for payloads from postgres");
|
||||||
|
|
||||||
let query = config.database_query.clone();
|
let query = config.database_query.clone();
|
||||||
@ -128,6 +120,14 @@ async fn main() {
|
|||||||
.await
|
.await
|
||||||
.unwrap_or_log();
|
.unwrap_or_log();
|
||||||
});
|
});
|
||||||
|
} else if let Some(client) = client.clone() {
|
||||||
|
tracing::info!("starting to listen for payloads from nats");
|
||||||
|
|
||||||
|
tokio::task::spawn(async {
|
||||||
|
tree::listen_for_payloads_nats(config_clone, pool, client, tree_clone, sender)
|
||||||
|
.await
|
||||||
|
.unwrap_or_log();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
panic!("no listener source available");
|
panic!("no listener source available");
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user