Skip to content

Commit

Permalink
Fix metric point counting within threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
JordyvanDortmont committed Apr 5, 2018
1 parent 3c51e51 commit 7dd94bd
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 7dd94bd

Please sign in to comment.