diff --git a/server/private-messages/database.ts b/server/private-messages/database.ts index c15c5a1d9314..4926d1cf3c9d 100644 --- a/server/private-messages/database.ts +++ b/server/private-messages/database.ts @@ -14,7 +14,7 @@ export const statements: {[k: string]: string} = { clearDated: 'DELETE FROM offline_pms WHERE ? - time >= ?', checkSentCount: 'SELECT count(*) as count FROM offline_pms WHERE sender = ? AND receiver = ?', setSeen: 'UPDATE offline_pms SET seen = ? WHERE receiver = ? AND seen IS NULL', - clearSeen: 'SELECT * FROM offline_pms WHERE ? - seen >= ?', + clearSeen: 'DELETE FROM offline_pms WHERE ? - seen >= ?', getSettings: 'SELECT * FROM pm_settings WHERE userid = ?', setBlock: 'REPLACE INTO pm_settings (userid, view_only) VALUES (?, ?)', deleteSettings: 'DELETE FROM pm_settings WHERE userid = ?', diff --git a/server/private-messages/index.ts b/server/private-messages/index.ts index 38b09ea8b0b3..5260cf045714 100644 --- a/server/private-messages/index.ts +++ b/server/private-messages/index.ts @@ -214,7 +214,7 @@ if (Config.usesqlite) { if (!process.send) { PM.spawn(Config.pmprocesses || 1); // clear super old pms on startup - void PM.run(statements.clearDated); + void PM.run(statements.clearDated, [Date.now(), EXPIRY_TIME]); } else if (process.send && process.mainModule === module) { global.Monitor = { crashlog(error: Error, source = 'A private message child process', details: AnyObject | null = null) {