indexer: Actually commit the transaction that resets the dead flag

This commit is contained in:
Yorhel 2024-05-13 10:38:48 +02:00
parent c67091f096
commit 9ff6bfc93f
2 changed files with 6 additions and 5 deletions

View file

@ -226,16 +226,18 @@ fn index_pkg<T: postgres::GenericClient>(tr: &mut T, mut opt: PkgOpt, pkgid: i32
pub fn pkg<T>(conn: &mut T, opt: PkgOpt) where T: postgres::GenericClient { pub fn pkg<T>(conn: &mut T, opt: PkgOpt) where T: postgres::GenericClient {
let mut tr = conn.transaction().unwrap(); let mut tr = conn.transaction().unwrap();
let pkg = insert_pkg(&mut tr, &opt);
let (pkgid,verid) = match insert_pkg(&mut tr, &opt) { Some(x) => x, None => return };
if unsafe { DRY_RUN } { if unsafe { DRY_RUN } {
return; return;
} }
if let Some((pkgid,verid)) = pkg {
if let Err(e) = index_pkg(&mut tr, opt, pkgid, verid) { if let Err(e) = index_pkg(&mut tr, opt, pkgid, verid) {
error!("Error reading package: {}", e); error!("Error reading package: {}", e);
return; return;
} }
}
if let Err(e) = tr.commit() { if let Err(e) = tr.commit() {
error!("Error finishing transaction: {}", e); error!("Error finishing transaction: {}", e);

View file

@ -1,6 +1,5 @@
use std::str::FromStr; use std::str::FromStr;
use std::io::{Read,BufRead,BufReader,Result}; use std::io::{Read,BufRead,BufReader,Result};
use std::collections::HashSet;
use regex::Regex; use regex::Regex;
use chrono::NaiveDateTime; use chrono::NaiveDateTime;
use postgres; use postgres;