feat: annealing for hot score & clean cache
This commit is contained in:
@@ -29,18 +29,18 @@ pub async fn delete(
|
||||
p.change_n_comments(&db, -1).await?;
|
||||
p.change_hot_score(&db, -1).await?;
|
||||
|
||||
p.refresh_cache(&rconn, false).await;
|
||||
p.clear_comments_cache(&rconn).await;
|
||||
}
|
||||
"pid" => {
|
||||
p = Post::get(&db, &rconn, di.id).await?;
|
||||
p.soft_delete(&user, &db).await?;
|
||||
// 如果是删除,需要也从0号缓存队列中去掉
|
||||
p.refresh_cache(&rconn, true).await;
|
||||
}
|
||||
_ => return Err(APIError::PcError(NotAllowed)),
|
||||
}
|
||||
|
||||
// 如果是删除,需要也从0号缓存队列中去掉
|
||||
p.refresh_cache(&rconn, true).await;
|
||||
|
||||
Ok(json!({
|
||||
"code": 0
|
||||
}))
|
||||
|
||||
@@ -164,7 +164,7 @@ pub async fn edit_cw(cwi: Form<CwInput>, user: CurrentUser, db: Db, rconn: RdsCo
|
||||
}
|
||||
p.check_permission(&user, "w")?;
|
||||
p.update_cw(&db, cwi.cw.to_string()).await?;
|
||||
p.refresh_cache(&rconn, false);
|
||||
p.refresh_cache(&rconn, false).await;
|
||||
Ok(json!({"code": 0}))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user