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

fix: dont include interval in lag #1504

Merged
merged 4 commits into from Oct 9, 2017
Merged

Conversation

retrohacker
Copy link
Member

@retrohacker retrohacker commented Sep 26, 2017

Pre-Submission Checklist

  • Opened an issue discussing these changes before opening the PR
  • Ran the linter and tests via make prepush
  • Included comprehensive and convincing tests for changes

Changes

What does this PR do?

Currently the lag metric for cpuUsageThrottle includes the interval. For example, an interval of 50 firing at the exact right moment will result in a lag of 50 as opposed to 0. This fixes that.

Also, this PR removes all timeouts after the cpuUsageThrottle tests.

* plugin.close for all tests
@retrohacker
Copy link
Member Author

Hmm, make prepush works for me locally. Removing arrow function.

@@ -30,7 +30,7 @@ describe('cpuUsageThrottle', function () {
var opts = { limit: 0, interval: 500 };
var plugin = cpuUsageThrottle(opts);
function next (cont) {
clearTimeout(plugin._timeout);
plugin.close();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this just be in an afterEach block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to do that without maintaining state outside the test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of - usually just use a plugin var within the closure.

@retrohacker retrohacker merged commit eecb2d2 into master Oct 9, 2017
@retrohacker retrohacker deleted the cpuUsageThrottleLagFix branch October 18, 2017 15:36
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

Successfully merging this pull request may close these issues.

None yet

2 participants