fix interruption handling by breaking the diff loop.

This commit is contained in:
Nathan TeBlunthuis
2025-12-18 18:00:30 -08:00
parent d7f5abef2d
commit 006feb795c
2 changed files with 14 additions and 9 deletions

View File

@@ -875,6 +875,8 @@ class WikiqParser:
new_diffs = []
diff_timeouts = []
for i, text in enumerate(row_buffer["text"]):
if self.shutdown_requested:
break
diff, timed_out = diff_with_timeout(differ, last_text, text)
if timed_out:
print(f"WARNING! wikidiff2 timeout for rev: {row_buffer['revid'][i]}. Falling back to default limits.", file=sys.stderr)
@@ -882,6 +884,9 @@ class WikiqParser:
new_diffs.append(diff)
diff_timeouts.append(timed_out)
last_text = text
if self.shutdown_requested:
print("Shutdown requested, closing writers...", file=sys.stderr)
break
row_buffer["diff"] = [
[
entry