Skip to content

Commit 826b32e

Browse files
author
Daniel Magliola
committed
Small file read performance improvement for DirectFileStore
Instead of two `read` operations, we can do both together at once Signed-off-by: Daniel Magliola <danielmagliola@gocardless.com>
1 parent 6bb7144 commit 826b32e

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/prometheus/client/data_stores/direct_file_store.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,7 @@ def all_values
257257
with_file_lock do
258258
@positions.map do |key, pos|
259259
@f.seek(pos)
260-
value = @f.read(8).unpack('d')[0]
261-
timestamp = @f.read(8).unpack('d')[0]
260+
value, timestamp = @f.read(16).unpack('dd')
262261
[key, value, timestamp]
263262
end
264263
end

0 commit comments

Comments
 (0)