lib/prometheus/client/mmaped_dict.rb in prometheus-client-mmap-0.7.0.beta10 vs lib/prometheus/client/mmaped_dict.rb in prometheus-client-mmap-0.7.0.beta11

- old
+ new

@@ -1,6 +1,7 @@ require 'prometheus/client' +require 'mmap' module Prometheus module Client class ParsingError < StandardError; end @@ -46,11 +47,14 @@ pos = @positions[key] # We assume that writing to an 8 byte aligned value is atomic. @m[pos..pos+7] = [value].pack('d') end - def close() + def close @m.munmap + rescue TypeError => e + Prometheus::Client.logger.warn("munmap raised error #{e}") + ensure @f.close end def initial_mmap_file_size Prometheus::Client.configuration.initial_mmap_file_size \ No newline at end of file