Use Postgres if database subscribe specified.

This commit is contained in:
Syfaro 2022-10-12 23:05:47 -04:00
parent e2266a6a7d
commit 76504cdc28

View File

@ -110,15 +110,7 @@ async fn main() {
let tree_clone = tree.clone();
let config_clone = config.clone();
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 if let Some(subscription) = config.database_subscribe.clone() {
if let Some(subscription) = config.database_subscribe.clone() {
tracing::info!("starting to listen for payloads from postgres");
let query = config.database_query.clone();
@ -128,6 +120,14 @@ async fn main() {
.await
.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 {
panic!("no listener source available");
};