fix up logged error for walreceiver connection failed

For some reason printing the Result made the error string print twice,
along with some annoying newlines. Extracting the error first gets the
expected result (just one explanation, no newlines)
This commit is contained in:
Eric Seppanen
2021-04-18 22:56:55 -07:00
parent 3725815935
commit 8d1bf152cf

View File

@@ -34,14 +34,15 @@ pub fn thread_main(conf: &PageServerConf, wal_producer_connstr: &str) {
runtime.block_on(async {
loop {
let _res = walreceiver_main(conf, wal_producer_connstr).await;
let res = walreceiver_main(conf, wal_producer_connstr).await;
// TODO: print/log the error
info!(
"WAL streaming connection failed, retrying in 1 second...: {:?}",
_res
);
sleep(Duration::from_secs(1)).await;
if let Err(e) = res {
info!(
"WAL streaming connection failed ({}), retrying in 1 second",
e
);
sleep(Duration::from_secs(1)).await;
}
}
});
}