Data: also yield while loading unparseable files

Otherwise, the UI would be blocked while loading something big that is not a
log file at all.
This commit is contained in:
René Stadler 2012-09-21 21:38:58 +02:00 committed by Stefan Sauer
parent fb032c177f
commit 6061f34506

View file

@ -314,6 +314,11 @@ class LineCache (Producer):
sort_helper = SortHelper (self.__fileobj, offsets) sort_helper = SortHelper (self.__fileobj, offsets)
find_insert_position = sort_helper.find_insert_position find_insert_position = sort_helper.find_insert_position
while True: while True:
i += 1
if i >= limit:
i = 0
yield True
offset = tell () offset = tell ()
line = readline () line = readline ()
if not line: if not line:
@ -336,10 +341,6 @@ class LineCache (Producer):
pos = find_insert_position (line) pos = find_insert_position (line)
levels.insert (pos, dict_levels_get (match.group (1), debug_level_none)) levels.insert (pos, dict_levels_get (match.group (1), debug_level_none))
offsets.insert (pos, offset) offsets.insert (pos, offset)
i += 1
if i >= limit:
i = 0
yield True
self.have_load_finished () self.have_load_finished ()
yield False yield False