@@ -4,7 +4,7 @@ use crate::worker::Worker;
4
4
use crate :: { storage, BackgroundJob } ;
5
5
use anyhow:: anyhow;
6
6
use diesel:: prelude:: * ;
7
- use diesel:: r2d2:: { ConnectionManager , Pool , PoolError , PooledConnection } ;
7
+ use diesel:: r2d2:: { ConnectionManager , Pool } ;
8
8
use futures_util:: future:: join_all;
9
9
use std:: collections:: HashMap ;
10
10
use std:: sync:: Arc ;
@@ -16,7 +16,6 @@ use tracing::{info, info_span, warn, Instrument};
16
16
const DEFAULT_POLL_INTERVAL : Duration = Duration :: from_secs ( 1 ) ;
17
17
18
18
pub type ConnectionPool = Pool < ConnectionManager < PgConnection > > ;
19
- pub type PooledConn = PooledConnection < ConnectionManager < PgConnection > > ;
20
19
21
20
/// The core runner responsible for locking and running jobs
22
21
pub struct Runner < Context > {
@@ -99,16 +98,13 @@ impl<Context: Clone + Send + Sync + 'static> Runner<Context> {
99
98
RunHandle { handles }
100
99
}
101
100
102
- pub fn connection ( & self ) -> Result < PooledConn , PoolError > {
103
- self . connection_pool . get ( )
104
- }
105
-
106
101
/// Check if any jobs in the queue have failed.
107
102
///
108
103
/// This function is intended for use in tests and will return an error if
109
104
/// any jobs have failed.
110
105
pub fn check_for_failed_jobs ( & self ) -> anyhow:: Result < ( ) > {
111
- let failed_jobs = storage:: failed_job_count ( & mut * self . connection ( ) ?) ?;
106
+ let mut conn = self . connection_pool . get ( ) ?;
107
+ let failed_jobs = storage:: failed_job_count ( & mut conn) ?;
112
108
if failed_jobs == 0 {
113
109
Ok ( ( ) )
114
110
} else {
0 commit comments