lib/determinator/tracking/tracker.rb in determinator-2.4.3 vs lib/determinator/tracking/tracker.rb in determinator-2.4.4
- old
+ new
@@ -5,22 +5,24 @@
module Tracking
class Tracker
attr_reader :type, :determinations
def initialize(type)
- @determinations = []
+ @determinations = Hash.new(0)
@type = type
@monotonic_start = now
@start = Time.now
end
def track(id, guid, feature, determination)
- determinations << Determinator::Tracking::Determination.new(
- id: id,
- guid: guid,
- feature_id: feature.identifier,
- determination: determination
- )
+ determinations[
+ Determinator::Tracking::Determination.new(
+ id: id,
+ guid: guid,
+ feature_id: feature.identifier,
+ determination: determination
+ )
+ ] += 1
end
def finish!(endpoint:, error:, **attributes)
request_time = now - @monotonic_start
Determinator::Tracking::Request.new(