19 lines
461 B
Rust
19 lines
461 B
Rust
// Db Commons
|
|
use fallible_iterator::{FallibleIterator};
|
|
use postgres::error::Error;
|
|
|
|
use net::{Db};
|
|
|
|
pub fn pg_listen(connection: Db) -> Result<(), Error> {
|
|
connection.execute("LISTEN events;", &[])?;
|
|
info!("pubsub listening");
|
|
let notifications = connection.notifications();
|
|
let mut n_iter = notifications.blocking_iter();
|
|
loop {
|
|
let n = n_iter.next()?;
|
|
if let Some(n) = n {
|
|
info!("{:?}", n);
|
|
}
|
|
}
|
|
}
|