auto expire journal entries after 6 hours

This commit is contained in:
Andris Reinman 2017-03-11 18:18:32 +02:00
parent 1ba5ba0c65
commit fd6e7983e3
2 changed files with 15 additions and 0 deletions

View file

@ -98,6 +98,10 @@ class ImapNotifier extends EventEmitter {
return callback(null, false);
}
entries.forEach(entry => {
entry.created = new Date();
});
this.database.collection('mailboxes').findOneAndUpdate({
username,
path

View file

@ -82,3 +82,14 @@ db.messages.createIndex({
db['attachments.files'].createIndex({
'metadata.messages': 1
});
db.journal.createIndex({
mailbox: 1,
modseq: 1
});
db.journal.createIndex({
created: 1
}, {
expireAfterSeconds: 21600
});