Closed shekit closed 4 years ago
@shekit were you able to figure this out?
@shekit we've made a few fixes around authentication, I'm also curious if you're continuing to bump into these issues.
Seems this issue has gone silent so I'm going to close it out. Please let us know if you think this is a mistake and we'll be happy to re-open.
Environment details
dialogflow
version: 0.8.0Steps to reproduce
I have dialogflow setup on a raspberry pi for a voice assistant and while the entire system is working I am facing an unusual problem.
When I initially boot up the system and send an audio stream from the mic to dialogflow for real time processing it returns the result after ~21 seconds. The subsequent audio requests sent are returning correctly within 1-2 seconds. This behaviour also reappears after a period of inactivity i.e if the system is already running and I don't make a voice request for ~3-5 mins.
Update: Also the delay on the first response is consistently reproduced down to the millisecond almost! I added some time logging to ascertain this. The image shows that the first response(red arrows) consistently takes 21.xx secs to return. Subsequent responses are in the 1-2 sec range.
I forcibly close the stream after 4000ms. What is interesting is that during my logging, when the stream is forcibly unpiped, the
unpipe
event is triggered but thefinish
event is not immediately triggered even though.end()
is correctly called on the stream within theunpipe
event handler. This only happens on the first request or after a period of inactivity and the finish event only gets triggered once dialogflow sends the result back after ~21 seconds. It's as if the stream is forcibly being kept open and calling .end() on it has no effect whatsoever.Here is my code:
Do note: This behaviour is more pronounced on the pi. The 21 second delay seems to be happening on the Pi. While the same behaviour is exhibited on my mac, the delay in the response after the first query is much less (~7 secs). There are no network connectivity issues, because the result is always returned, just after a huge gap. I've also tried with a different internet connection. This issue also happens when I just use google cloud speech.
To check if this was some kind of issue with streams, I created a dummy stream in which I simply output the mic recording to a .wav file. This worked fine and this time the .end() is called immediately & correctly from within the unpipe event. I went one step further and streamed this .wav file to dialogflow instead of from the mic and then the behaviour returned! 21.xx seconds!!!
I'm also attaching a gif of the logging. If you watch the entire thing (there's a long gap in the middle so keep watching :)) you'll see the issue I'm talking about. As you'll see the first result takes a long time to return whereas the subsequent queries returns instantly.
Any help would be appreciated! This is driving me crazy!