@@ -56,15 +56,14 @@ def hash_to_line(hash)
5656 end
5757 module_function :hash_to_line
5858
59- def line_is_current ?( timestamp , limit : 86_400 )
59+ def line_is_recent ?( timestamp , max_age_sec : 86_400 )
6060 return false unless timestamp . is_a? ( Integer )
61- return false unless limit . is_a? ( Integer )
61+ return false unless max_age_sec . is_a? ( Integer )
6262
63- current_time = DateTime . now . strftime ( '%s%9N' ) . to_i
64- time_limit = current_time - ( limit * 1000 * 1000 * 1000 * 3 )
65- timestamp >= time_limit
63+ current_epoch_ns = DateTime . now . strftime ( '%s%9N' ) . to_i
64+ timestamp >= current_epoch_ns - ( max_age_sec * 1000 * 1000 * 1000 * 3 )
6665 end
67- module_function :line_is_current ?
66+ module_function :line_is_recent ?
6867
6968 def field_is_number? ( value )
7069 return false if value . nil?
@@ -113,7 +112,7 @@ def valid_tag_chars
113112
114113 def line_is_valid? ( line ) # rubocop:disable Metrics/AbcSize
115114 line = parse ( line ) if line . is_a? ( String )
116- return "line is too old, #{ line } " unless line_is_current ?( line [ :timestamp ] )
115+ return "line is too old, #{ line } " unless line_is_recent ?( line [ :timestamp ] )
117116 return "line is missing influxdb_database, #{ line } " unless node_group_tag? line [ :tags ]
118117 return "line is missing influxdb_node_group, #{ line } " unless database_tag? line [ :tags ]
119118 return "measurement name #{ line [ :measurement ] } is not valid" unless measurement_valid? ( line [ :measurement ] )
0 commit comments