8000 Also set the mmap mode to match the read_mode flag. · danarwix/client_python@8586b8d · GitHub
[go: up one dir, main page]

Skip to content

Commit 8586b8d

Browse files
coderangerbrian-brazil
authored andcommitted
Also set the mmap mode to match the read_mode flag.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
1 parent 0cedb75 commit 8586b8d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

prometheus_client/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ def __init__(self, filename, read_mode=False):
509509
if os.fstat(self._f.fileno()).st_size == 0:
510510
self._f.truncate(_INITIAL_MMAP_SIZE)
511511
self._capacity = os.fstat(self._f.fileno()).st_size
512-
self._m = mmap.mmap(self._f.fileno(), self._capacity)
512+
self._m = mmap.mmap(self._f.fileno(), self._capacity, access=mmap.ACCESS_READ if read_mode else mmap.ACCESS_WRITE)
513513

514514
self._positions = {}
515515
self._used = _unpack_integer(self._m, 0)[0]

0 commit comments

Comments
 (0)
0