Skip to content

Commit

Permalink
Offline messages: Ensure proper clearing of old messages on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Mar 18, 2024
1 parent c1eeb7e commit dd4b004
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/private-messages/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ?',
Expand Down
2 changes: 1 addition & 1 deletion server/private-messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit dd4b004

Please sign in to comment.