Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zero does not work when eventObj is null #25

Open
genru opened this issue Mar 12, 2019 · 0 comments
Open

zero does not work when eventObj is null #25

genru opened this issue Mar 12, 2019 · 0 comments

Comments

@genru
Copy link

genru commented Mar 12, 2019

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)
        })
    })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant