Skip to content

Build your personal knowledge base with Trilium Notes

recent notes are kept only for one day

azivnere47027cbef50
diff --git a/routes/api/recent_notes.js b/routes/api/recent_notes.js
index ed56a5f993..a3c6a807a8 100644
--- a/routes/api/recent_notes.js
+++ b/routes/api/recent_notes.js
@@ -49,13 +49,13 @@ async function getRecentNotes() {
}
async function deleteOld() {
- const cutoffDateAccessed = await sql.getSingleValue("SELECT date_accessed FROM recent_notes WHERE is_deleted = 0 ORDER BY date_accessed DESC LIMIT 100, 1");
+ const cutoffDateAccessed = utils.nowTimestamp() - 24 * 60 * 60;
- if (cutoffDateAccessed) {
- await sql.doInTransaction(async () => {
- await sql.execute("DELETE FROM recent_notes WHERE date_accessed < ?", [cutoffDateAccessed]);
- });
- }
+ await sql.doInTransaction(async () => {
+ await sql.execute("DELETE FROM recent_notes WHERE date_accessed < ?", [cutoffDateAccessed]);
+
+ await sql.execute("DELETE FROM sync WHERE entity_name = 'recent_notes' AND sync_date < ?", [cutoffDateAccessed]);
+ });
}
module.exports = router;
\ No newline at end of file
diff --git a/services/build.js b/services/build.js
index 57573f7f06..02ff003c36 100644
--- a/services/build.js
+++ b/services/build.js
@@ -1 +1 @@
-module.exports = { build_date:"2017-11-26T23:24:39-05:00", build_revision: "1231e02449c08f8f794277e6de7fd401535aa57d" };
+module.exports = { build_date:"2017-11-28T22:01:30-05:00", build_revision: "14001f67d87a7c7d900088807337fcda0d2fb9a0" };