From b97c4ffc16fe14fcf40d4808835b3fa3c46e9b1c Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 27 Nov 2023 00:14:56 +0100 Subject: util.datamanager: Load first item into index earlier Should get rid of fseek() call --- util/datamanager.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util/datamanager.lua') diff --git a/util/datamanager.lua b/util/datamanager.lua index 6d61aea5..ca77cda8 100644 --- a/util/datamanager.lua +++ b/util/datamanager.lua @@ -424,7 +424,8 @@ local function get_list_index(username, host, datastore) end if ih then - return setmetatable({ file = ih }, index_mt); + local first_length = string.unpack(ih:read(index_item_size)); + return setmetatable({ file = ih; { start = 0; length = first_length } }, index_mt); end local index, err = build_list_index(username, host, datastore); -- cgit v1.2.3