lib/prometheus/client/mmaped_dict.rb in prometheus-client-mmap-0.7.0.beta41 vs lib/prometheus/client/mmaped_dict.rb in prometheus-client-mmap-0.7.0.beta42

- old
+ new

@@ -37,19 +37,14 @@ rescue StandardError => e raise ParsingError, "exception #{e} while processing metrics file #{path}" end def read_value(key) - pos = @m.add_entry(@positions, key, 0.0) - - @m.get_double(pos) + @m.fetch_entry(@positions, key, 0.0) end def write_value(key, value) - pos = @m.add_entry(@positions, key, 0.0) - - # pos = @positions[key] - @m[pos..pos + 7] = [value].pack('d') + @m.upsert_entry(@positions, key, value) end def path @m.filepath if @m end