let postgres_manager = ConnectionManager::<PgConnection>::new("postgre://bac");
let pool = Pool::new(postgres_manager)?;
Currently it produces following output:
2020-05-13T16:30:07.777244900+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:07.778244700+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
2020-05-13T16:30:08.179240800+03:00 ERROR r2d2 - missing "=" after "postgre://bac" in connection info string
...
It returns Err in the end, but it takes time and unnessessary requests to db.
I think probably it should check if connection is ok before initializing pool. Something like:
pub fn new(manager: M) -> Result<Pool<M>, Error> {
let _test_connecction = manager.connect()?;
Pool::builder().build(manager)
}
Consider following code
Currently it produces following output:
It returns
Err
in the end, but it takes time and unnessessary requests to db.I think probably it should check if connection is ok before initializing pool. Something like: