mirror of
https://github.com/wekan/wekan.git
synced 2026-02-07 09:01:47 +01:00
Speed improvement: Delete presences older than one week, and add index to presences serverId.
Thanks to xet7 ! Related #3345
This commit is contained in:
parent
ce1f3365bb
commit
9db3c93116
2 changed files with 14 additions and 2 deletions
12
models/presences.js
Normal file
12
models/presences.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
if (Meteor.isServer) {
|
||||
Meteor.startup(() => {
|
||||
// Date of 7 days ago
|
||||
let lastWeek = new Date();
|
||||
lastWeek.setDate(lastWeek.getDate() - 7);
|
||||
|
||||
presences.remove({ ttl: { $lte: lastWeek } });
|
||||
|
||||
// Create index for serverId that is queried often
|
||||
presences._collection._ensureIndex({ serverId: -1 });
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue