Skip to content

zero does not work when eventObj is null #25

@genru

Description

@genru

Hi,

thanks for your great job. I just tried to clean all event counter but it seems does not work. I wrote some code to reproduce this issue hope it helps.

zero specified event(zero({eventObj: '123456'}) in my case) works perfectly

"redis-metrics": "^2.0.0"
...
const hitCounter = metrics.counter('anchorQueryHit', { timeGranularity: 'day' });
...
    describe.only('#zero', () => {
        it('should clean all', function(done) {
            hitCounter.incr({eventObj:'123456'}).then((data) => {
                return hitCounter.count({eventObj: '123456'})
            }).then(count => {
                // count.should.equal(1);
                return hitCounter.zero();          // <--- expect all counter cleaned, include '123456's
            }).then(() => {
                return hitCounter.count({eventObj: '123456'});
            }).then(count => {
                count.should.equal(0);            // <--- no, it does not
                done();
            }).catch(done)
        })
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions