fn prune_message_history(conn: &mut DatabaseConnection, now: &SystemTime) {
    let mut st = match conn.prepare_cached("DELETE FROM message_history WHERE replaced <= ?") {
        Ok(st) => st,
        Err(e) => {
            error!("Unable to prepare message history prune statement: {}", e);
            return;
        }
    };
    let now_secs = (*now - MESSAGE_HISTORY_PRUNE_THRESHOLD)
        .duration_since(SystemTime::UNIX_EPOCH)
        .unwrap()
        .as_secs_f64();
    let count = match st.execute(params![now_secs]) {
        Ok(count) => count,
        Err(e) => {
            error!("Unable to prune message history: {}", e);
            return;
        }
    };
    if count > 0 {
        info!("Pruned {} message edits/deletions", count);
    }
}
/// Prune old message edit/deletion history
Prune old message edit/deletion history
Prune old message edit / deletion history
fn prune_message_history(conn: &mut DatabaseConnection, now: &SystemTime) {
    let mut st = match conn.prepare_cached("DELETE FROM message_history WHERE replaced <= ?") {
        Ok(st) => st,
        Err(e) => {
            error!("Unable to prepare message history prune statement: {}", e);
            return;
        }
    };
    let now_secs = (*now - MESSAGE_HISTORY_PRUNE_THRESHOLD)
        .duration_since(SystemTime::UNIX_EPOCH)
        .unwrap()
        .as_secs_f64();
    let count = match st.execute(params![now_secs]) {
        Ok(count) => count,
        Err(e) => {
            error!("Unable to prune message history: {}", e);
            return;
        }
    };
    if count > 0 {
        info!("Pruned {} message edits/deletions", count);
    }
}
fn prune_message_history ( conn : & mut DatabaseConnection , now : & SystemTime ) { let mut st = match conn . prepare_cached ( " " ) { Ok ( st ) => st , Err ( e ) => { error ! ( " " e ) ; return ; } } ; let now_secs = ( * now - MESSAGE_HISTORY_PRUNE_THRESHOLD ) . duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs_f64 ( ) ; let count = match st . execute ( params ! [ now_secs ] ) { Ok ( count ) => count , Err ( e ) => { error ! ( " " e ) ; return ; } } ; if count > 0 { info ! ( " " count ) ; } }
Prune old message edit/deletion history
Prune old message edit / deletion history
conn
&mut DatabaseConnection
now
&SystemTime
conn
&mut DatabaseConnection
now
&SystemTime