Skip to content

Commit

Permalink
chore(db): extend the expire time of ephemeral threads (#3218)
Browse files Browse the repository at this point in the history
* refactor(db): extend the expire time of ephemeral threads

* update: test
  • Loading branch information
liangfung authored Sep 29, 2024
1 parent bb44761 commit f932f60
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ee/tabby-db/src/threads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl DbConn {
}

pub async fn delete_expired_ephemeral_threads(&self) -> Result<usize> {
let time = (Utc::now() - Duration::hours(4)).as_sqlite_datetime();
let time = (Utc::now() - Duration::days(7)).as_sqlite_datetime();

let res = query!(
r#"
Expand Down Expand Up @@ -397,8 +397,8 @@ mod tests {
let _ephemeral_thread_id = db.create_thread(user_id, true).await.unwrap();
let non_ephemeral_thread_id = db.create_thread(user_id, false).await.unwrap();

// Update the updated_at time to be 8 hours ago for all threads
sqlx::query!("UPDATE threads SET updated_at = DATETIME('now', '-8 hours')",)
// Update the updated_at time to be 8 days ago for all threads
sqlx::query!("UPDATE threads SET updated_at = DATETIME('now', '-8 days')",)
.execute(&db.pool)
.await
.unwrap();
Expand Down

0 comments on commit f932f60

Please sign in to comment.