# HG changeset patch # User Kim Alvefur # Date 1557241807 -7200 # Node ID c24d43ababc618c34ee0b1ba7e478c751642992b # Parent 796b29911747bb0014c242a61cfe72e985db7b04 mod_storage_xmlarchive: Try harder to limit range of time to check Fixes read of entire index in case where the time range is outside the range present in the archive. diff -r 796b29911747 -r c24d43ababc6 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon May 06 16:05:00 2019 +0200 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue May 07 17:10:07 2019 +0200 @@ -109,16 +109,20 @@ local rev = query.reverse; if query.start then local d = dt.date(query.start); - for i = 1, #dates do - if dates[i] >= d then + for i = start_day, last_day, step do + if dates[i] < d then + start_day = i + 1; + elseif dates[i] >= d then start_day = i; break; end end end if query["end"] then local d = dt.date(query["end"]); - for i = #dates, 1, -1 do - if dates[i] <= d then + for i = last_day, start_day, -step do + if dates[i] > d then + last_day = i - 1; + elseif dates[i] <= d then last_day = i; break; end end