Skip to content

Commit

Permalink
Merge pull request #2998 from JordyvanDortmont/2.4
Browse files Browse the repository at this point in the history
Fix metric point counting within threshold
  • Loading branch information
jbrooksuk committed Apr 23, 2018
2 parents 01d8841 + 7dd94bd commit 7d9fbb8
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function handle(CreateMetricPointCommand $command)
*/
protected function findOrCreatePoint(CreateMetricPointCommand $command)
{
$buffer = Carbon::now()->subMinutes($command->metric->threshold);
$buffer = Carbon::now()->subMinutes($command->metric->threshold - 1)->startOfMinute();

if ($point = MetricPoint::where('metric_id', '=', $command->metric->id)->where('value', '=', $command->value)->where('created_at', '>=', $buffer)->first()) {
return $point;
Expand Down

0 comments on commit 7d9fbb8

Please sign in to comment.