未验证 提交 3d995461 编写于 作者: 走神的阿圆's avatar 走神的阿圆 提交者: GitHub

add timeout for file queue (#772)

上级 8fc815f0
......@@ -21,6 +21,9 @@ import struct
import time
import queue
import threading
import os
QUEUE_TIMEOUT = os.getenv("VDL_QUEUE_TIMEOUT")
class RecordWriter(object):
......@@ -145,7 +148,10 @@ class _AsyncWriter(object):
with self._lock:
if self._closed:
raise IOError("Writer is closed.")
self._bytes_queue.put(bytestring)
try:
self._bytes_queue.put(bytestring, timeout=QUEUE_TIMEOUT)
except queue.Full:
print('This data was not written to the log due to timeout.')
def flush(self):
with self._lock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册