Comparison

util/datamanager.lua @ 13235:dbd7a6b09ada

util.datamanager: Close file handle when done using it It gets closed eventually but at high load they could potentially lead to reaching FD limits faster.
author Kim Alvefur <zash@zash.se>
date Fri, 21 Jul 2023 18:28:54 +0200
parent 13234:c886ea087b38
child 13236:9c72f93b7a02
comparison
equal deleted inserted replaced
13234:c886ea087b38 13235:dbd7a6b09ada
359 end 359 end
360 -- seek position is at the start of the next line within each loop iteration 360 -- seek position is at the start of the next line within each loop iteration
361 -- so we need to collect the "current" position at the end of the previous 361 -- so we need to collect the "current" position at the end of the previous
362 prev_pos = fh:seek() 362 prev_pos = fh:seek()
363 end 363 end
364 fh:close();
364 if prev_pos ~= 0 then 365 if prev_pos ~= 0 then
365 t_insert(items, { start = last_item_start; length = prev_pos - last_item_start }); 366 t_insert(items, { start = last_item_start; length = prev_pos - last_item_start });
366 end 367 end
367 return items; 368 return items;
368 end 369 end