aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2023-11-27 00:14:56 +0100
committerKim Alvefur <zash@zash.se>2023-11-27 00:14:56 +0100
commitb97c4ffc16fe14fcf40d4808835b3fa3c46e9b1c (patch)
tree61bbb7f75f3cfb3eeb23931f1462e7e83e351b9c
parentf5f64e3bdc3c355b9e3e0a37e092169bc1842ff3 (diff)
downloadprosody-b97c4ffc16fe14fcf40d4808835b3fa3c46e9b1c.tar.gz
prosody-b97c4ffc16fe14fcf40d4808835b3fa3c46e9b1c.zip
util.datamanager: Load first item into index earlier
Should get rid of fseek() call
-rw-r--r--util/datamanager.lua3
1 files changed, 2 insertions, 1 deletions
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);