10000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b91aff3 commit b325a5eCopy full SHA for b325a5e
prometheus_client/mmap_dict.py
@@ -37,9 +37,11 @@ class MmapedDict(object):
37
def __init__(self, filename, read_mode=False):
38
self._f = open(filename, 'rb' if read_mode else 'a+b')
39
self._fname = filename
40
- if os.fstat(self._f.fileno()).st_size == 0:
+ capacity = os.fstat(self._f.fileno()).st_size
41
+ if capacity == 0:
42
self._f.truncate(_INITIAL_MMAP_SIZE)
- self._capacity = os.fstat(self._f.fileno()).st_size
43
+ capacity = _INITIAL_MMAP_SIZE
44
+ self._capacity = capacity
45
self._m = mmap.mmap(self._f.fileno(), self._capacity,
46
access=mmap.ACCESS_READ if read_mode else mmap.ACCESS_WRITE)
47
0 commit comments