Skip to content

Commit

Permalink
Flush hits when no activity from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
Knyffen committed Dec 30, 2023
1 parent f43877b commit 40eec6a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions import_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import os.path
import queue
import re
import select
import ssl
import sys
import threading
Expand Down Expand Up @@ -2506,6 +2507,13 @@ def filtered_line(line, reason):
hits = []
lineno = -1
while True:
has_line = lambda f: select.select([f, ], [], [], 0.0)[0]
if os.name == 'posix' and file == sys.stdin and not has_line(file):
Recorder.add_hits(hits)
hits = []
time.sleep(1)
continue

line = file.readline()
if not line: break
lineno = lineno + 1
Expand Down

0 comments on commit 40eec6a

Please sign in to comment.