fix: 修正数据库删除为异步

This commit is contained in:
lyz05
2025-07-04 14:55:59 +08:00
parent 20f3a09cb1
commit bd142354d8
3 changed files with 4 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ Express框架的性能也比Python的Django要好很多。
# fly.io常用命令 # fly.io常用命令
``` sh ``` sh
flyctl logs
flyctl status flyctl status
flyctl scale count 0 flyctl scale count 0
flyctl regions add sea flyctl regions add sea

View File

@@ -116,8 +116,8 @@ router.get("/", async function (req, res) {
}); });
router.get("/delete", async function (req, res) { router.get("/delete", async function (req, res) {
const rows = await db.deleteAccess(); const rows = db.deleteAccess();
res.send(`删除三个月以前的记录,删除${rows}条记录`); res.send(`成功请求删除三个月以前的记录,删除情况请查看日志`);
}); });
module.exports = router; module.exports = router;

View File

@@ -117,6 +117,7 @@ async function deleteAccess() {
changes += result.changes; changes += result.changes;
// vacuum // vacuum
await run("vacuum"); await run("vacuum");
console.log("deleteAccess Affect Rows:",changes)
return changes; // 提取删除的行数 return changes; // 提取删除的行数
} catch (err) { } catch (err) {
console.error('Error during data deletion:', err.message); console.error('Error during data deletion:', err.message);