Add timeout to consumer queue get

Prevents hanging on config reload
pull/1159/head
Matthew D. Scholefield 2017-10-16 12:58:12 -05:00
parent 8c696b0586
commit b53e0bb202
1 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@
# limitations under the License.
#
import time
from Queue import Queue
from Queue import Queue, Empty
from threading import Thread
import speech_recognition as sr
@ -96,9 +96,9 @@ class AudioConsumer(Thread):
self.read()
def read(self):
audio = self.queue.get()
if audio is None:
try:
audio = self.queue.get(0.5)
except Empty:
return
if self.state.sleeping: