recent notes are kept only for one day

This commit is contained in:
azivner 2017-11-29 20:30:47 -05:00
parent 14001f67d8
commit e47027cbef
2 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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" };