Add logging

This commit is contained in:
nielsandriesse 2021-06-03 09:54:09 +10:00
parent 3c97465783
commit d2c81f2af7
1 changed files with 2 additions and 2 deletions

View File

@ -250,13 +250,13 @@ pub async fn prune_files(file_expiration: i64) {
// Get a database connection and open a transaction
let conn = match pool.get() {
Ok(conn) => conn,
Err(e) => return error!("Couldn't prune files due to error: {}.", e),
Err(e) => return error!("Couldn't get database connection to prune files due to error: {}.", e),
};
// Get the IDs of the files to delete
let raw_query = format!("SELECT id FROM {} WHERE timestamp < (?1)", FILES_TABLE);
let mut query = match conn.prepare(&raw_query) {
Ok(query) => query,
Err(e) => return error!("Couldn't prune files due to error: {}.", e),
Err(e) => return error!("Couldn't prepare query to prune files due to error: {}.", e),
};
let rows = match query.query_map(params![expiration], |row| row.get(0)) {
Ok(rows) => rows,