forked from square/cube
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts @76a7527. That change introduced a bug because I forgot {multi: true}, so the collector was only invalidating the first matching first metric for a given event, rather than all of them. Also, by delaying metric invalidation, the evaluator is less likely to encounter the race condition where a new event is collected between the evaluator reading the events and saving the computed metric. Still, this solution is not perfect.
- Loading branch information
Showing
3 changed files
with
79 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = bisect; | ||
|
||
function bisect(a, x) { | ||
var lo = 0, hi = a.length; | ||
while (lo < hi) { | ||
var mid = lo + hi >> 1; | ||
if (a[mid] < x) lo = mid + 1; | ||
else hi = mid; | ||
} | ||
return lo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters