File tree 1 file changed +4
-13
lines changed 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -22,19 +22,10 @@ fn main() {
22
22
loop {
23
23
let conn = postgres:: Connection :: connect ( & env ( "DATABASE_URL" ) [ ..] ,
24
24
& postgres:: SslMode :: None ) . unwrap ( ) ;
25
- {
26
- let tx = conn. transaction ( ) . unwrap ( ) ;
27
- update ( & tx) . unwrap ( ) ;
28
- tx. set_commit ( ) ;
29
- tx. finish ( ) . unwrap ( ) ;
30
- }
25
+ update ( & conn) . unwrap ( ) ;
31
26
drop ( conn) ;
32
27
if daemon {
33
- #[ allow( deprecated) ]
34
- fn do_sleep ( sleep : Option < i64 > ) {
35
- std:: thread:: sleep ( Duration :: seconds ( sleep. unwrap ( ) ) ) ;
36
- }
37
- do_sleep ( sleep) ;
28
+ std:: thread:: sleep ( Duration :: seconds ( sleep. unwrap ( ) ) ) ;
38
29
} else {
39
30
break
40
31
}
@@ -48,10 +39,10 @@ fn env(s: &str) -> String {
48
39
}
49
40
}
50
41
51
- fn update ( tx : & postgres:: Transaction ) -> postgres:: Result < ( ) > {
42
+ fn update ( conn : & postgres:: GenericConnection ) -> postgres:: Result < ( ) > {
52
43
let mut max = 0 ;
53
44
loop {
54
- let tx = try!( tx . transaction ( ) ) ;
45
+ let tx = try!( conn . transaction ( ) ) ;
55
46
{
56
47
let stmt = try!( tx. prepare ( "SELECT * FROM version_downloads \
57
48
WHERE processed = FALSE AND id > $1
You can’t perform that action at this time.
0 commit comments