File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 1
1
import io
2
2
import queue
3
3
import threading
4
- from time import perf_counter_ns
5
4
6
5
from . import igzip
7
6
@@ -44,7 +43,11 @@ def _decompress(self):
44
43
return
45
44
if not data :
46
45
return
47
- block_queue .put (data )
46
+ while self .running :
47
+ try :
48
+ block_queue .put (data , timeout = 0.05 )
49
+ except queue .Full :
50
+ pass
48
51
49
52
def readinto (self , b ):
50
53
result = self .buffer .readinto (b )
@@ -61,6 +64,7 @@ def readinto(self, b):
61
64
return 0
62
65
self .buffer = io .BytesIO (data_from_queue )
63
66
result = self .buffer .readinto (b )
67
+ self .pos += result
64
68
return result
65
69
66
70
def readable (self ) -> bool :
@@ -73,4 +77,6 @@ def tell(self) -> int:
73
77
return self .pos
74
78
75
79
def close (self ) -> None :
80
+ self .running = False
81
+ self .worker .join ()
76
82
self .fileobj .close ()
You can’t perform that action at this time.
0 commit comments