notification listener: Exit process on panic
@@ -115,6 +115,8 @@ impl NotificationListener {
let (sender, receiver) = channel(1024);
let worker_handle = thread::spawn(move || {
+ // We exit the process on panic so unwind safety is irrelevant.
+ std::panic::catch_unwind(std::panic::AssertUnwindSafe(move || {
// Connect to Postgres
let conn = Connection::connect(postgres_url, TlsMode::None)
.expect("failed to connect notification listener to Postgres");
@@ -176,6 +178,8 @@ impl NotificationListener {
}
}
}
+ }))
+ .unwrap_or_else(|_| std::process::exit(1))
});
(receiver, worker_handle, terminate_worker, worker_barrier)
