Only cleanup high frequency events in eventlog

Those are currently the login events and backup
This commit is contained in:
Johannes Zellner
2016-11-18 11:32:11 +01:00
parent 7c27f01ab8
commit 552ca43175
3 changed files with 31 additions and 10 deletions

View File

@@ -1166,14 +1166,24 @@ describe('database', function () {
});
it('delByCreationTime succeeds', function (done) {
eventlogdb.delByCreationTime(new Date(), function (error) {
async.each([ 'persistent.event', 'transient.event', 'anothertransient.event', 'anotherpersistent.event' ], function (e, callback) {
eventlogdb.add('someid' + Math.random(), e, { ip: '1.2.3.4' }, { appId: 'thatapp' }, callback);
}, function (error) {
expect(error).to.be(null);
eventlogdb.getAllPaged(null, null, 1, 1, function (error, results) {
expect(error).to.be(null);
expect(results.length).to.be(0);
var actions = [ 'anotherpersistent.event', 'persistent.event' ];
done();
eventlogdb.delByCreationTime(new Date(), actions, function (error) {
expect(error).to.be(null);
eventlogdb.getAllPaged(null, null, 1, 100, function (error, results) {
expect(error).to.be(null);
expect(results.length).to.be(2);
expect(results[1].action).to.be.eql('persistent.event');
expect(results[0].action).to.be.eql('anotherpersistent.event');
done();
});
});
});
});